摘要: 简简单单的并查集,再加上模拟合并找值 #include<bits/stdc++.h>using namespace std;const int N = 2e5 + 7;int f1[N], f2[N];int u1[N], u2[N], v1[N], v2[N];int ans1[N], ans2[ 阅读全文
posted @ 2022-10-31 18:56 feuerwerk 阅读(21) 评论(0) 推荐(0)
摘要: 感觉可以用tarjan,但奈何弱小的我并没有学过QAQ; 这题的坑就在排序上面 #include<bits/stdc++.h>using namespace std;const int N = 1e6 + 7;struct Edge{ int u, v;}a[N];int f[N];bool cmp 阅读全文
posted @ 2022-10-31 18:27 feuerwerk 阅读(33) 评论(0) 推荐(0)
摘要: 简简单单的一个并查集 #include<bits/stdc++.h>using namespace std;const int N = 1e6 + 7;int u[N], v[N], f[1010];int find (int x) { return f[x] == x ? x : f[x] = f 阅读全文
posted @ 2022-10-31 09:38 feuerwerk 阅读(36) 评论(0) 推荐(0)