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<iostream>
using namespace std;
int N,c[1500],d[1500],ar[1500][1500];
void dfs(int u){
if(c[u]==d[u]){
for(int i=0;i<N;i++){
if(ar[u][i]&&c[i]!=d[i]){
c[i]++;
dfs(i);
}
}
}
}
void initialize(int n){
N=n;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i!=j)ar[i][j]=1;
for(int i=0;i<n;i++)c[i]=1,d[i]=n-1;
}
int hasEdge(int u,int v){
if(c[u]!=d[u]&&c[v]!=d[v]){
d[u]--;
d[v]--;
ar[u][v]=ar[v][u]=0;
if(c[u]==d[u]&&c[v]==d[v])dfs(u),dfs(v);
else if(c[u]==d[u])dfs(u);
else dfs(v);
return 0;
}
return ar[u][v];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |