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;
bitset<300000> e;
vector<int> ad[300000];
bool r=0;
void dfs(int xf){
e[xf]=1;
for(auto i : ad[xf]){
if(i<k)r=1;
else if(!e[i])dfs(i);
}
return;
}
void init(int N, int K) {
n=N;
k=K;
for(int i=0; i<k; i++)e[i]=1;
return;
}
int add_teleporter(int u, int v) {
if(r)return 1;
if(e[u]){
if(v<k)r=1;
else if(!e[v]){
dfs(v);
}
}
else ad[u].push_back(v);
return r;
}
# | 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... |