上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页
摘要: 例题素数密度 template<typename T> struct segment_sieve { vector<bool> is_prime, is_prime_small; vector<T> prime; segment_sieve() { is_prime.resize(1000010); 阅读全文
posted @ 2023-12-16 16:27 Ke_scholar 阅读(27) 评论(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 阅读全文
posted @ 2023-12-12 23:09 Ke_scholar 阅读(34) 评论(0) 推荐(0)
摘要: P1525 [NOIP2010 提高组] 关押罪犯 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 种类并查集 #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std 阅读全文
posted @ 2023-12-12 17:24 Ke_scholar 阅读(49) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2023-12-12 02:08 Ke_scholar 阅读(29) 评论(0) 推荐(0)
摘要: 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); 阅读全文
posted @ 2023-12-09 23:44 Ke_scholar 阅读(26) 评论(0) 推荐(0)
摘要: 已通过洛谷模板:(【矩阵快速幂】、【行列式计算】) template<class T> struct Matrix { i64 N; vector<vector<T>> A; Matrix() : N(0) {} Matrix(int n) : N(n), A(n, vector<T>(n, 0)) 阅读全文
posted @ 2023-12-05 15:20 Ke_scholar 阅读(38) 评论(2) 推荐(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 阅读全文
posted @ 2023-12-04 12:51 Ke_scholar 阅读(67) 评论(0) 推荐(0)
摘要: 哈尔滨华德学院-新生编程挑战赛 A-签到_哈尔滨华德学院-新生编程挑战赛(同步赛) (nowcoder.com) 签到 #include <bits/stdc++.h> #define debug(a) cout<<#a<<"="<<a<<'\n'; using namespace std; usi 阅读全文
posted @ 2023-12-03 17:03 Ke_scholar 阅读(16) 评论(0) 推荐(0)
摘要: A. Flipping Game 本质上是让我们找出一段区间内\(0\)的个数大于\(1\)的个数的最多的区间,且必须进行一次操作,所以可以考虑区间\(dp\),或者最小子序列和 1 最小子序列和 \[\begin{aligned} dp_i是以a_i结尾的最小子序列和 \\ dp_i=\min(d 阅读全文
posted @ 2023-12-02 16:01 Ke_scholar 阅读(26) 评论(0) 推荐(0)
摘要: 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 \ \ 阅读全文
posted @ 2023-12-02 14:42 Ke_scholar 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页