#include using namespace std; struct UnionFind { vector par; vector sz; UnionFind(int n=0){ if(n>0) initialize(n); } void initialize(int n){ par.resize(n); sz.assign(n, 1); for(int i=0; i sz[y]) swap(x, y); par[x] = y; sz[y] += sz[x]; return true; } bool same(int x, int y){ return find(x) == find(y); } int size(int x){ return sz[find(x)]; } }; int main(){ int N, A, B; cin >> N >> A >> B; vector X(N); for(int i=0; i> X[i]; UnionFind uf(N); vector imos(N); for(int i=0; i