Submission #302652

#TimeUsernameProblemLanguageResultExecution timeMemory
302652dCodingGame (IOI14_game)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; #define F first #define S second const int MAXN = 1505; int coredge[MAXN], deg[MAXN]; set<pair<int, int>> s; int n; void initialize(int _n) { n = _n; for(int i=0;i<n;i++) s.insert({deg[i], i}); } int hasEdge(int u, int v) { ++coredge[u]; ++coredge[v]; int topnode = s.begin()->S; if(u != topnode && v != topnode) { s.erase({deg[u],u}); s.erase({deg[v],v}); ++deg[u]; ++deg[v]; s.insert({deg[u],u}); s.insert({deg[v],v}); return 1; } else { if((u == topnode && coredge[u] == n-1) || (v == topnode && coredge[v] == n-1)) { s.erase({deg[u],u}); s.erase({deg[v],v}); ++deg[u]; ++deg[v]; s.insert({deg[u],u}); s.insert({deg[v],v}); return 1; } else { return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...