This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <algorithm>
int C[21][21],D[21],E[21],F[21];
int Compare(const void* a, const void* b)
{
return E[*(int*)b]-E[*(int*)a];
}
long long int NumberOfMaps(int N, int M, int* A,int* B)
{
long long int i,j,k=1;
for(i=1;i<=N;i++)F[i]=i;
for(i=0;i<M;i++)
{
C[A[i]][B[i]]=C[B[i]][A[i]]=1;
E[A[i]]++;
E[B[i]]++;
}
qsort(F+1,N,sizeof(int),Compare);
for(i=1;E[F[1]];)
{
for(j=i+1;j<=N;j++)
{
if(C[F[i]][F[j]])
{
D[F[j]]--;
E[F[i]]--;
E[F[j]]--;
C[F[i]][F[j]]=C[F[j]][F[i]]=0;
}
}
qsort(F+1,N,sizeof(int),Compare);
}
for(i=1;i<=N;i++)
k*=D[i]+4;
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... |