Submission #1082179

#TimeUsernameProblemLanguageResultExecution timeMemory
1082179logangdGame (IOI14_game)C++14
42 / 100
1071 ms12884 KiB
#include "game.h" #include<set> using namespace std; int N,vs[1500],c=0; set<int>ar[1500]; 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].insert(j),ar[j].insert(i); } bool dfs(int u,int v){ if(u==v)return 1; vs[u]=c; for(auto i:ar[u]) if(vs[i]!=c) if(dfs(i,v))return 1; return 0; } int hasEdge(int u,int v){ c++; ar[u].erase(v); ar[v].erase(u); if(dfs(u,v))return 0; ar[u].insert(v); ar[v].insert(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...