@[HGerdd](/user/1270412) 你并查集的并入操作有问题:
你的(WA):
```c
if(find(p,x)!=find(p,y))
{
p[y] = x;//并入
ans --;
}
```
正确的:
```c
if(find(p,x)!=find(p,y))
{
p[find(p,y)] = find(p,x);//并入
ans --;
}
```
[评测记录](https://www.luogu.com.cn/record/146488068)
by StarsIntoSea_SY @ 2024-02-07 20:28:43