https://cses.fi/problemset/task/1676/ CSES - Road Construction cses.fi #include #include using namespace std; const int N = 200001; class UFDS { private: vector p, rank, setSizes; int numSets; public: UFDS(int N) { numSets = N; rank.assign(N, 0); p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; setSizes.assign(N, 1); } int findSet(int i) { return (p[i] == i) ? i : p[i] = findSet(p[i]); } bo..