~~该回去再学学并查集了~~
by DOs__lx @ 2020-02-16 12:50:54
@[DOs__lx](/user/261006) 你这显然不对啊,find里面值改变了fa[x]的值又没改变x的值,显然循环会一直执行。并查集最好:
```cpp
inline int find(int x) {
return x == f[x] ? x : f[x] = find(f[x]);
}
```
这样写
by Smallbasic @ 2020-02-16 12:53:26
@[Smallbasic](/user/98096) 谢谢了,我的并查集该回炉重造了
by DOs__lx @ 2020-02-16 13:14:14