上一页 1 2 3 4 5 6 ··· 26 下一页
摘要: 异或的性质 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; int a[N]; void solve() { cin >> n; for 阅读全文
posted @ 2022-08-14 17:12 wKingYu 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 带权并查集 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, m; int p[N], d[N]; int find(int x) { if 阅读全文
posted @ 2022-08-12 23:32 wKingYu 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 带权并查集 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, m; int p[N], d[N]; int find(int x) { if 阅读全文
posted @ 2022-08-12 22:39 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 先合并集合,最后统计集合个数 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, m; int p[N]; int find(int x) { 阅读全文
posted @ 2022-08-11 23:55 wKingYu 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 先合并集合,最后统计多少学生和 $0$ 号学生属于同一集合 并查集 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, m; int a[N] 阅读全文
posted @ 2022-08-11 23:49 wKingYu 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 特定条件合并集合 并查集 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, d; int p[N]; bool open[N]; struc 阅读全文
posted @ 2022-08-11 23:34 wKingYu 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 单点修改(更新),区间查询(最大值) 线段树 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 5e5 + 10; int n, m; int w[N]; struct No 阅读全文
posted @ 2022-08-11 23:07 wKingYu 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 单点修改(增加),区间查询(区间和) 线段树 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 5e5 + 10; int n; int w[N]; struct Node 阅读全文
posted @ 2022-08-11 22:56 wKingYu 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 二分 + 双端队列广搜 复杂度 $m \cdot log(r - l) = 1 \times 10^4 \times log(10^9) = 3 \times 10^5$ 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long 阅读全文
posted @ 2022-08-10 23:44 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 最短路 + DFS 枚举顺序 最短路用堆优化 dijkstra 复杂度 $O(m \cdot log(n)) = 10^5 \cdot log(5 \times 10^4) \approx 1.56 \times 10^6$ DFS 枚举复杂度 $O(n!) = 5! = 120$ 两个复杂度是相加 阅读全文
posted @ 2022-08-10 22:29 wKingYu 阅读(24) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 26 下一页