
并查集
Griffin_0
这个作者很懒,什么都没留下…
展开
-
hdu1213 How Many Tables 并查集
#include#include#define Maxn 1024int father[Maxn];void init(int n){ for(int i=1;i<=n;i++) father[i]=i;}int getf(int x){ if(x!=father[x]) father[x]=getf(father[x]); return fathe原创 2015-10-08 17:32:10 · 372 阅读 · 0 评论 -
hdu1856 More is better 并查集
#include#include#define Maxn 10000005int father[Maxn],num[Maxn];void init(){ for(int i=1;i<=Maxn;i++) { father[i]=i; num[i]=1; }}int getf(int x){ if(x!=father[x])原创 2015-10-08 20:20:13 · 408 阅读 · 0 评论 -
hdu1272 小希的迷宫 并查集
#include#include#include#include#include#include#include#include #include #include #include #include #include#define Maxn 100005typedef long long ll;#define rep(i,j,n) for(int i=j;i<=n;原创 2015-10-08 18:29:23 · 358 阅读 · 0 评论