// 并查集开路。 int find(int x) { if(x!=fa[x]) fa[x]=find(fa[x]); return fa[x]; } void union(int x,int y) { int a=find(x),b=find(y); if(a!=b) fa[b]=a; }