- 家族
- 2010-03-17 20:09:53 @
#include
using namespace std;
const int N=5001;
int father[N],n,m,j;
int find(int x)
{if(father[x]!=-1)
return father[x]=find(father[x]);
else
return x;
}
void out(int x,int y)
{int t1,t2;
t1=find(x);
t2=find(y);
if(t1==t2)
coutt2;
merge(t1,t2); }
for(i=1;i>t1>>t2;
out(t1,t2);}
return 00;
}
1 条评论
-
sunday1742 LV 7 @ 2010-07-22 00:04:55
不用加freopen
vijos的io是屏幕io不用加freopen
- 1