随笔分类 - 并查集
摘要:解析 由于数据太大了, \(10^9\) 的内存绝对会炸, 所以要用离散化 Code #include <bits/stdc++.h> using namespace std; int n, m, z, x, y; int f[10005]; int find (int x) { while (x
阅读全文
摘要:解析 这道题是一道冰茶姬的模板题, 不必多言, 直接上代码 Code #include <bits/stdc++.h> using namespace std; int n, m, z, x, y; int f[10005]; int find (int x) { while (x != f[x])
阅读全文