Submission #985409

#TimeUsernameProblemLanguageResultExecution timeMemory
985409SuPythonyGame (APIO22_game)C++17
12 / 100
4043 ms728 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; int n,k; vector<vector<int>> al; void init(int N, int K) { n=N; k=K; al.assign(n,vector<int>()); for (int i=0; i<k-1; i++) al[i].push_back(i+1); } vector<int> vis(n,0); bool dfs(int u, int i) { vis[u]=1; for (int v: al[u]) { if (v==i) return true; if (vis[v]) continue; if (dfs(v,i)) return true; } return false; } int add_teleporter(int u, int v) { al[u].push_back(v); for (int i=0; i<k; i++) { vis.assign(n,0); if (dfs(i,i)) 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...