带路径压缩的并查集(刘汝佳)
int fa[100];int find(x){return x==fa[x]?x:fa[x]=find(fa[x]);}void Union(x,y){ x=find(x);y=find(y); fa[x]=y;}
本文共 182 字,大约阅读时间需要 1 分钟。
带路径压缩的并查集(刘汝佳)
int fa[100];int find(x){return x==fa[x]?x:fa[x]=find(fa[x]);}void Union(x,y){ x=find(x);y=find(y); fa[x]=y;}
转载于:https://www.cnblogs.com/maoruimas/p/9737643.html