Submission #582528

#TimeUsernameProblemLanguageResultExecution timeMemory
582528MurotYGame (APIO22_game)C++17
2 / 100
17 ms23888 KiB
#include <bits/stdc++.h> #define ll long long #include "game.h" using namespace std; const int N=1e6+7; vector <ll> g[N]; ll used[N], sz; void init(int n, int k) { for (int i=0;i<k-1;i++){ g[i].push_back(i+1); } sz=k; } int add_teleporter(int u, int v) { if (u == v && u < sz) return 1; else if (u == v) return 0; g[u].push_back(v); bool ok=0; fill(used, used+10000, 0); function <void(ll,ll)> dfs = [&] (ll v, ll p){ used[v]=1; for (auto l:g[v]){ if (used[l] == 0) dfs(l, v); else if (used[l] == 1 && l != p){ ok=1; return ; } } used[v]=2; }; dfs(0, 0); if (ok) return 1; else 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...