Submission #1082172

#TimeUsernameProblemLanguageResultExecution timeMemory
1082172logangdGame (IOI14_game)C++14
15 / 100
1 ms836 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; dfs(u); dfs(v); return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...