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 "game.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int l[1501];
int ways[1501][1501];
void initialize(int N)
{
n=N;
for(int i=0;i<n;i++)
l[i]=i;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
ways[i][j]=1;
}
int hasEdge(int u, int v)
{
if(l[u]!=l[v]&&ways[l[u]][l[v]]==1)
{
int t1=l[u];
int t2=l[v];
ways[l[u]][l[v]]--;
ways[l[v]][l[u]]--;
for(int i=0;i<n;i++)
{
ways[l[u]][i]+=ways[l[v]][i];
ways[i][l[u]]=ways[l[u]][i];
}
for(int i=0;i<n;i++)
if(l[i]==t2)l[i]=t1;
/*for(int i=0;i<n;i++)
cout<<l[i]<<" ";
cout<<endl;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cout<<i<<" "<<j<<" "<<ways[i][j]<<endl;*/
return 1;
}
ways[l[u]][l[v]]--;
ways[l[v]][l[u]]--;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |