并查集的标准写法
int group(int x){
return f[x]==x?x:f[x]=group(f[x]);
}
void merge(int a,int b){
int x=group(a);
int y=group(b);
if(x!=y){
f[y]=x;
}
}
并查集的标准写法
int group(int x){
return f[x]==x?x:f[x]=group(f[x]);
}
void merge(int a,int b){
int x=group(a);
int y=group(b);
if(x!=y){
f[y]=x;
}
}