Welcome To Ke_scholar'|

Ke_scholar

园龄:2年1个月粉丝:30关注:10

12 2023 档案

树状数组模板
摘要:单点修改,区间查询/区间修改,单点查询 template<typename T> struct BIT { int n; vector<T> w; BIT() {} BIT(int n) { this->n = n; w.resize(n + 1); } void update(int x, int
38
1
0
Kruskal和Prim模板
摘要:例题:P3366 【模板】最小生成树 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) Kruskal #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std; usi
18
0
0
区间素数筛模板
摘要:例题素数密度 template<typename T> struct segment_sieve { vector<bool> is_prime, is_prime_small; vector<T> prime; segment_sieve() { is_prime.resize(1000010);
9
0
0
素数判断优化
摘要:bool isPrime(int x) { if (x <= 3) return x > 1; if (x % 6 != 1 && x % 6 != 5) return false; int n = sqrt(x); for (int i = 5; i <= n; i += 6) if (x % i
9
0
0
拓扑排序模板
摘要:#include <bits/stdc++.h> using namespace std; struct toposort { vector<vector<int>> e; vector<int> tp , din; int n ; toposort() {} toposort(int n) { t
24
0
0
[NOIP2010 提高组] 关押罪犯 - 洛谷
摘要:P1525 [NOIP2010 提高组] 关押罪犯 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 种类并查集 #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std
26
0
0
最近公共祖先模板(LCA)
摘要:include <bits/stdc++.h> using namespace std; struct LCA { int n; vector<int> dep; vector<vector<int>> e; vector<array<int, 21>> fa; LCA() {} LCA(int n
16
0
0
Dijkstra单源最短路模板
摘要:struct DIJ { using i64 = long long; using PII = pair<i64, i64>; vector<i64> dis; vector<vector<PII>> G; DIJ() {} DIJ(int n) { dis.assign(n + 1, 1e18);
14
0
0
矩阵模板
摘要:struct Matrix { i64 N; vector<vector<i64>> A; Matrix() { N = 0;} Matrix(int n) { N = n; A.resize(N + 1); for (int i = 0; i <= N; i ++) A[i].resize(N +
23
0
0
字典树模板
摘要:#include <bits/stdc++.h> using namespace std; struct trie { int n; vector<array<int, 26>> trans; vector<int> cnt; trie() : n(0) { new_node(); } int ne
58
0
0
哈尔滨华德学院-新生编程挑战赛
摘要:哈尔滨华德学院-新生编程挑战赛 A-签到_哈尔滨华德学院-新生编程挑战赛(同步赛) (nowcoder.com) 签到 #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std; usi
10
0
0
A. Flipping Game
摘要:A. Flipping Game 本质上是让我们找出一段区间内\(0\)的个数大于\(1\)的个数的最多的区间,且必须进行一次操作,所以可以考虑区间\(dp\),或者最小子序列和 1 最小子序列和 \[\begin{aligned} dp_i是以a_i结尾的最小子序列和 \\ dp_i=\min(d
16
0
0
B. BerSU Ball
摘要:B. BerSU Ball 排序后考虑\(dp\),\(dp_{i,j}\)表示前\(i\)个男生和前\(j\)个女生能匹配的最大数. \[\begin{aligned} if(|a_i - b_j| \le 1) \ dp_{i,j} = dp_{i-1,j-1} + 1 \\ else \ \
6
0
0
二分图最大匹配模板(匈牙利算法)
摘要:二分图最大匹配模板(匈牙利算法) P3386 【模板】二分图最大匹配 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) struct augment_path { vector<vector<int> > g; vector<int> pa; // 匹配 vector<int> pb
29
0
0
点击右上角即可分享
微信分享提示
深色
回顶
收起