#include #include "disjoint_set.hpp" #define endl '\n' using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); auto ds = disjoint_set()->with_undo()->init(2); cout << ds->root(0) << " " << ds->size(0) << " " << ds->root(1) << " " << ds->size(1) << endl; ds->merge(0, 1); cout << ds->root(0) << " " << ds->size(0) << " " << ds->root(1) << " " << ds->size(1) << endl; ds->undo(); cout << ds->root(0) << " " << ds->size(0) << " " << ds->root(1) << " " << ds->size(1) << endl; return 0; }