Submission #317796

#TimeUsernameProblemLanguageResultExecution timeMemory
317796miss_robotGame (IOI14_game)C++14
42 / 100
1051 ms12224 KiB
#include <bits/stdc++.h> #include "game.h" #pragma GCC optimize("O3") using namespace std; int n; vector< unordered_set<int> > g; vector<int> vis; void initialize(int N){ n = N; g.resize(n); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(i != j) g[i].insert(j); } int dfs(int u, int w){ if(vis[u]) return 0; vis[u] = 1; if(u == w) return 1; for(int v : g[u]) if(dfs(v, w)) return 1; return 0; } int hasEdge(int u, int v) { if(!g[u].count(v)) return 0; g[u].erase(v), g[v].erase(u); vis.assign(n, 0); if(dfs(u, v)) return 0; g[u].insert(v), g[v].insert(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...