摘要:#include<stdio.h>#include<stdlib.h>#include<string.h>#define maxn 10000010 int father[maxn],d[maxn];int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x),y=find(y); if(x!=y) father[x]=y; }int main( ){ int N,i,j,a,b,k,t=0; while(scanf(&
阅读全文
摘要:#include<stdio.h>#include<stdlib.h>#include<string.h>int father[1100];int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x),y=find(y); if(x!=y) father[x]...
阅读全文
摘要:#include<stdio.h>#include<algorithm>using namespace std;int father[110],N,M;struct node{ int i,j,v;}T[5000];int cmp(node a,node b){ return a.v<b.v;}int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x); y=find(y); if(x!=y) father[x]=y;}in
阅读全文
摘要:#include<stdio.h>int father[1100],N,M;int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x); y=find(y); if(x!=y) father[x]=y;}int main( ){ while(scanf("%d%d",&N,&M),N) { int i,j,a,b,count=1; for(i=1;i<=N;i++) father[i]=i; for(
阅读全文
摘要:#include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>using namespace std;struct node{ int i; int j; int v;}T[5000];int father[110],rank[110];int N,M,t;int cmp(node a,node b){ return a.v<b.v;}int find(int x){ return x==father[x]?x:father[x]=find(father[x]
阅读全文
摘要:#include<stdio.h>#include<stdlib.h>#include<algorithm>using namespace std;struct node{ int i,j,v,u;}T[10100];int father[10100],N,M;int cmp(node a,node b){ return a.v<b.v;}int find(int x){ return x==fa...
阅读全文