摘要: 1 阅读全文
posted @ 2025-06-15 10:14 Leocsse 阅读(0) 评论(0) 推荐(0)
摘要: A 枚举所有情况 #include <bits/stdc++.h> using namespace std; #define INF 1e18 #define endl '\n' #define LL long long #define ph push_back #define inf 0x3f3f 阅读全文
posted @ 2023-04-05 17:38 Leocsse 阅读(72) 评论(0) 推荐(0)
摘要: 看不懂题解的再问我 A #include <bits/stdc++.h> using namespace std; #define endl '\n' #define LL long long #define ph push_back #define INF 0x3f3f3f3f #define P 阅读全文
posted @ 2023-03-18 16:35 Leocsse 阅读(120) 评论(0) 推荐(0)
摘要: 所有必败态的所有下一个状态一定是必胜态 所有必胜态的至少一个下一个状态一定是必败态 得知 可以到达必败点的点全是必胜点,只能到达必胜点的点都是必败点 https://ac.nowcoder.com/acm/contest/51458/F 阅读全文
posted @ 2023-03-12 14:36 Leocsse 阅读(15) 评论(0) 推荐(0)
摘要: 求每个数的最大质数用埃氏筛法,时间复杂度 O(nlognlogn) void get_primes(int n) { for (int i = 2; i <= n; i ++) if (!st[i]) { maxp[i] = i; for (int j = i + i; j <= n; j += i 阅读全文
posted @ 2022-11-27 13:58 Leocsse 阅读(29) 评论(0) 推荐(0)
摘要: 树形DP 一、在u的子树中,选择一个大小恰好为m的包含u点的连通块,最大的权值和(u,m<=2e3) 这样写虽然是三重循环但是时间复杂度是O(nm)的 void dfs(int u) { sz[u] = 0; for (int v : son[u]) { dfs(v); for (int i = 0 阅读全文
posted @ 2022-11-16 17:04 Leocsse 阅读(32) 评论(0) 推荐(0)
摘要: Floyd 求无向图最小环问题 https://www.acwing.com/problem/content/346/ floyd是典型的插点算法,每次插入点k,为此,在点k被[插入前]可计算i-j-k这个环即此时中间节点为:1~k-1,即我们已经算出了任意i<->j的最短道路,中间经过的节点可以为 阅读全文
posted @ 2022-11-08 19:49 Leocsse 阅读(51) 评论(0) 推荐(0)
摘要: 字典树模板+初始化模板 https://codeforces.com/contest/1658/problem/D2 int l, r; int son[M][2], idx; int a[N]; void init() {//初始化** idx = 0; son[0][0] = son[0][1] 阅读全文
posted @ 2022-11-03 19:54 Leocsse 阅读(45) 评论(0) 推荐(0)
摘要: getline与stringstream的用法 https://www.acwing.com/problem/content/922/ #include <bits/stdc++.h> using namespace std; const int N = 505; int n, m; int dis 阅读全文
posted @ 2022-10-28 16:36 Leocsse 阅读(35) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m; int w[N]; struct node { int l, r; LL sum, add; }tr[N * 4]; void pushup( 阅读全文
posted @ 2022-10-13 20:46 Leocsse 阅读(104) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示