This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
int C[30][30],D[30],E[30];
void dfs(int i,int N)
{
int t;
if(E[i]==1)
return;
E[i]=1;
for(t=1;t<=N;t++)
{
if(C[i][t])
D[t]--;
C[t][i]=0;
}
for(t=1;t<=N;t++)
{
if(C[i][t])
{
C[i][t]=0;
dfs(t,N);
}
}
}
long long int NumberOfMaps(int N, int M, int* A,int* B)
{
int i;long long int k=1;
for(i=0;i<M;i++)
{
C[A[i]][B[i]]=C[B[i]][A[i]]=1;
}
for(i=1;i<=N;i++)
{
if(E[i]==0)
dfs(i,N);
}
for(i=1;i<=N;i++)
{
if(D[i]+4<0)
{
k=0;
break;
}
k*=D[i]+4;
}
if(k==1)return 0;
return k;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |