Submission #706539

#TimeUsernameProblemLanguageResultExecution timeMemory
706539grossly_overconfidentGame (APIO22_game)C++17
0 / 100
213 ms262144 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adjchart; int K, N; bool cycledetector4000(int i, int oi, bool f, vector<bool>& q, vector<bool>& dpcache){ if (!f && i == oi){ return true; } if (q[i]){ return dpcache[i]; } bool pl = false; for (int j : adjchart[i]){ pl |= cycledetector4000(j, oi, false, q, dpcache); } q[i] = true; return dpcache[i] = pl; } void init(int n, int k) { adjchart.resize(n); K = k; N = n; for (int i = 0; i < k - 1; ++i){ adjchart[i].push_back(i + 1); } } int add_teleporter(int u, int v) { adjchart[u].push_back(v); vector<bool> q(N); vector<bool> dpcache(N); bool pl = false; for (int i = 0; i < K; ++i){ pl |= cycledetector4000(i, i, true, q, dpcache); } if (pl){ return 1; } 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...