6497번

· 백준
코드#include #include #include #include using namespace std;int m, n, x, y, z, lst[200003], cnt, res, total;vector>> adj;int find(int x) { if (x == lst[x]) return x; return lst[x] = find(lst[x]);}void merge(int x, int y) { x = find(x); y = find(y); if (x > y) lst[x] = y; else lst[y] = x;}bool cmp(pair> a, pair> b) { return a.first > m >> n; if (m == 0 && n == 0) break; CLEAR(); for (int i = 0; ..