Submission #1082185

#TimeUsernameProblemLanguageResultExecution timeMemory
1082185logangdGame (IOI14_game)C++14
15 / 100
2 ms4612 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...