摘要: A.单点修改区间查询 板子 点击查看代码 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e6 + 0721; int c[N]; int n, m; int lowbit(int 阅读全文
posted @ 2023-06-29 17:37 Steven24 阅读(126) 评论(0) 推荐(0)
摘要: A.合并果子 很容易想到 先合并的果子 对答案的贡献明显更多 所以我们每次合并都取最小的两堆进行合并 因为每次变动的元素数量很少 选择堆排 点击查看代码 #include <bits/stdc++.h> #define ll long long using namespace std; ll ans 阅读全文
posted @ 2023-06-29 15:36 Steven24 阅读(134) 评论(0) 推荐(0)
摘要: A.有向图缩点 板子 讲解有时间补 咕 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 200721; int head[N], nxt[N], to[N], v[N], cnt; int sccnum[N], s 阅读全文
posted @ 2023-06-29 14:37 Steven24 阅读(92) 评论(0) 推荐(0)
摘要: A.单源最短路径 板子 没啥好说的 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 0721; int head[N], to[N], nxt[N], len[N], cnt; bool vis[N]; 阅读全文
posted @ 2023-06-29 11:48 Steven24 阅读(113) 评论(0) 推荐(0)
摘要: 前注:本文涉及的所有求最小生成树的算法均为 \(kruskal\) A.繁忙都市 要求联通并且边最少 \(n\) 个节点联通最少要 \(n - 1\) 条边 那不就是棵树嘛 然后跑最小生成树就行了 点击查看代码 #include <bits/stdc++.h> using namespace std 阅读全文
posted @ 2023-06-29 10:06 Steven24 阅读(101) 评论(0) 推荐(0)
摘要: A.并查集 他都说模板了!!! 那就是板子 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 1e4 + 0721; int fa[N]; int n, m; int find(int x) { if (x == f 阅读全文
posted @ 2023-06-29 09:04 Steven24 阅读(122) 评论(0) 推荐(0)