Submission #856241

#TimeUsernameProblemLanguageResultExecution timeMemory
856241HakiersGame (IOI14_game)C++17
42 / 100
1061 ms12916 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1600; set<int> G[MAXN]; int cnt = 0; bool visited[MAXN]; int nx; void check(int v, int p){ cnt++; visited[v] = 1; for(auto u: G[v]){ if(u == p || visited[u]) continue; check(u, v); } } int hasEdge(int u, int v){ auto it = G[v].find(u); if(it == G[v].end()) return 0; G[v].erase(it); G[u].erase(v); cnt = 0; for(int i = 0; i < nx; i++) visited[i] = 0; check(u, u); if(cnt == nx) return 0; G[v].insert(u); G[u].insert(v); return 1; } void initg(int n){ for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(i != j) G[i].insert(j); } void initialize(int n){ initg(n); nx = n; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...