Submission #962817

#TimeUsernameProblemLanguageResultExecution timeMemory
9628170npataGame (APIO22_game)C++17
0 / 100
1 ms1880 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; const int N = 30'005; const int K = 1'005; #define pb push_back #define vec vector vec<int> nk(N, -1); vec<set<pair<int, int>>> g(N); int k; int n; void init(int in, int ik) { n = in; k = ik; } int add_teleporter(int u, int v) { nk[v] = max(nk[v], nk[u]); g[u].insert({nk[v], v});; vec<int> stack{v}; while(stack.size() > 0) { int cur = stack.back(); stack.pop_back(); vec<pair<int, int>> upd(0); for(auto nxt : g[k]) { int l = nxt.second; if(l<k) { // special node if(nk[cur] >= nk[l]) { return 1; } } if(nk[l] < nk[cur]) { stack.pb(l); nk[l] = nk[cur]; upd.pb(nxt); } else if(nk[l] != nxt.first) { upd.pb(nxt); } } for(auto val : upd) { g[cur].erase(val); g[cur].insert({val.second, nk[val.second]}); } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...