This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |