Submission #1158371

#TimeUsernameProblemLanguageResultExecution timeMemory
1158371The_SamuraiGame (APIO22_game)C++20
0 / 100
0 ms320 KiB
#include "game.h" #include "bits/stdc++.h" using namespace std; const int inf = 1e9; int n, k; vector<vector<int>> g; vector<int> start; queue<int> q; void init(int _n, int _k) { n = _n, k = _k; start = vector(n, -inf); for (int i = 0; i < k; i++) start[i] = i; g.assign(n, vector<int>()); } int add_teleporter(int u, int v) { if (u == v and u < k) return 1; if (u == v) return 0; g[u].emplace_back(v); if (start[u] <= start[v]) return 0; q.push(v); while (!q.empty()) { int v = q.front(); q.pop(); start[v] = start[u]; if (v < k and v <= start[v]) return 1; for (int x: g[v]) { if (start[x] < start[u]) q.push(x); } } 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...