@[1596093267ybd](/space/show?uid=112604) 考虑一下路径压缩?
by 狸狸养的敏敏 @ 2019-07-20 17:37:40
请写并查集的优化,路径压缩 or 按秩合并
by Nickel_Angel @ 2019-07-20 17:38:07
@[狸狸养的敏敏](/space/show?uid=58399)
过了~~我的问题~~谢谢
by Mr__Meng @ 2019-07-20 17:40:26
@[Nickel_Angel](/space/show?uid=121638)
过了谢谢
by Mr__Meng @ 2019-07-20 17:40:43
~~~
return fa[x] == x ? x : fa[x] = find(fa[x]) ;
~~~
by 1saunoya @ 2019-07-20 18:16:41
@[1596093267ybd](/space/show?uid=112604)
by 1saunoya @ 2019-07-20 18:16:55
少了个路径压缩
by MiKu_Yin @ 2019-07-23 20:06:19