제출 #982699

#제출 시각아이디문제언어결과실행 시간메모리
982699vjudge1게임 (APIO22_game)C++17
0 / 100
2 ms7512 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector <ll>; const ll MAXN = 3E5+16; int n, k; vll adj[MAXN]; void init (int n, int k) { ::n = n, ::k = k; for (ll i = 1; i < k; i++) { adj[i-1].push_back(i); } } ll tvis[MAXN]; ll timer = 1; ll dfs (ll u, ll par, ll lastK) { if (tvis[u] == timer) return 0; tvis[u] = timer; for (ll v : adj[u]) { if (v <= lastK) return 1; if (dfs(v, u, (u < k ? u : lastK))) return 1; } return 0; } int add_teleporter (int u, int v) { adj[u].push_back(v); timer++; return dfs(0, 0, 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...