Submission #744767

#TimeUsernameProblemLanguageResultExecution timeMemory
744767TeemkaGame (APIO22_game)C++17
0 / 100
4 ms4944 KiB
#include "bits/stdc++.h" #include "game.h" #define F first #define S second #define OK cout << "------OK---------" << endl; #define deb(x) cout << #x << " = " << x << endl; #define ll long long ; using namespace std ; const int N = 2e5 + 7; const int INF = 1e9 + 7 ; const int dx[4] = {0 , 1 , 0 , -1} , dy[4] = {1 , 0 , -1 , 0} ; int n , k , used[N] , tim = 0 , ok = 0; vector<int > g[N] ; void dfs(int v){ used[v] = tim ; for(int to : g[v]){ if(used[to] == tim){ if(to <= k - 1) ok = 1; continue ; } dfs(to) ; } } void init(int _n, int _k) { n = _n , k = _k ; for(int i = 0; i< k - 1; i++){ g[i].push_back(i + 1) ; } } int add_teleporter(int u, int v) { g[u].push_back(v) ; tim++ ; dfs(0) ; return ok ; }
#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...