#include
long p[1000];
long parent(long x)
{
if(p[x]==-1)
return x;
else
{
p[x]=parent(p[x]);
return p[x];
}
}
int main()
{
long i,n,N,M,A,B,count[1000],max,p1,p2;
scanf("%ld",&n);
while(n--)
{
scanf("%ld%ld",&N,&M);
for(i=0;i<=N;i++) { p[i]=-1; count[i]=0; } for(i=0;i
long p[1000];
long parent(long x)
{
if(p[x]==-1)
return x;
else
{
p[x]=parent(p[x]);
return p[x];
}
}
int main()
{
long i,n,N,M,A,B,count[1000],max,p1,p2;
scanf("%ld",&n);
while(n--)
{
scanf("%ld%ld",&N,&M);
for(i=0;i<=N;i++) { p[i]=-1; count[i]=0; } for(i=0;i
No comments:
Post a Comment