![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
是Lr呀
这个作者很懒,什么都没留下…
展开
-
并查集模板
#include<bits/stdc++.h> using namespace std; const int maxn=1e6; int father[maxn]; int Find(int x)//寻找根节点 { if(father[x]==x)return x; return father[x]=Find(father[x]); } void Union(int x,int ...原创 2020-03-14 20:32:46 · 71 阅读 · 0 评论 -
家庭问题(family)
思路:并查集去做 #include<bits/stdc++.h> using namespace std; const int maxn=1e6; int father[maxn]; int Find(int x) { if(father[x]==x)return x; return father[x]=Find(father[x]); } void Union(int x,in...原创 2020-03-14 20:29:15 · 689 阅读 · 0 评论