CPLibrary

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub o06660o/CPLibrary

:heavy_check_mark: src/ds/dsu_short.hpp

Verified with

Code

struct DSU {
  vector<int> fa;
  DSU(int n) : fa(n) { iota(ALL(fa), 0); }
  int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
};
#line 1 "src/ds/dsu_short.hpp"
struct DSU {
  vector<int> fa;
  DSU(int n) : fa(n) { iota(ALL(fa), 0); }
  int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
};
Back to top page