路径压缩
by 捻红尘似水 @ 2018-08-22 21:20:50
@[KagurazakaKano](/space/show?uid=19533) 加路径压缩:
```cpp
int getF(int x){
if(f[x] == x){
return x;
} else {
return f[x] = getF(f[x]);
}
}
```
by hellomath @ 2018-08-22 21:21:12
@[larryzhong](/space/show?uid=20438) 感谢!
by KagurazakaKano @ 2018-08-22 21:28:10
%%%
by 7KByte @ 2018-09-25 21:51:35