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 "game.h"
#include<bits/stdc++.h>
using namespace std;
int N,K;
bool vis[1010],top[1010];
vector<int> adj[1010];
void init(int n, int k) {
N=n;K=k;
for(int i=0; i<k-1; i++){
adj[i].push_back(i+1);
}
}
bool ord(int a){
if(vis[a] && top[a]==0 && a<K){
//cout<<'>'<<a<<endl;
return true;
}
if(vis[a])return false;
vis[a] = true;
for (int it: adj[a]){
if(ord(it)){
//cout<<'>'<<a<<endl;
return true;
}
}
top[a]=1;
return false;
}
int add_teleporter(int u, int v) {
for(int i=0; i<N; i++)vis[i]=0,top[i]=0;
adj[u].push_back(v);
for(int i=0; i<N; i++)if(!vis[i])if(ord(i))return 1;
return 0;
}
# | 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... |