can someone tell me what was wrong with my code for the firescape problem that was in the march long challenge…here is my code…
#include<stdio.h>
int f[3][100002];
int create(long int n){
long int i;
for(i=1;i<=n;i++){
f[0][i]=0;
f[2][i]=1;
}
return 0;
}
int main()
{
long int t,n,m,a,b,c,d,i;
long int sum=0,gp=0;
unsigned long long int prod=1;
scanf("%d",&t);
while(t--)
{
scanf("%ld %ld",&n,&m);
create(n);
while(m--)
{sum=0;
gp=0;
prod=1;
scanf("%ld %ld",&a,&b);
c=f[0][a]==0?a:b;
d=a+b-c;
while(f[0][c]!=0)
{c=f[0][c];}
sum=f[2][c];
while(f[0][d]!=0)
{d=f[0][d];}
if(c==d)
continue;
f[2][d]+=sum;
f[2][c]=1;
f[0][c]=d;
}
for(i=1;i<=n;i++)
{prod=(prod*f[2][i])%1000000007;
if(f[0][i]==0)
gp++;
}
printf("%ld %llu\n",gp,prod);
}
return 0;
}