
并查集
是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 · 104 阅读 · 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 · 774 阅读 · 0 评论