이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "game.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define PI 3.1415926535897932384626433
#define all(s) s.begin(),s.end()
vector<ll>dv[300005];
ll df[300005];
ll cur=0;
int n,k;
bool dfs(ll u){
if(df[u]==2) return true;
if(df[u]==1) return u>=k;
df[u]=1;
for(auto x:dv[u]){
if(dfs(x)==false){
return false;
}
}
df[u]=2;
return true;
}
void init(int N,int K){
n=N;
k=K;
for(int i=0;i<=k-2;i++){
dv[i].pb(i+1);
}
}
int add_teleporter(int u,int v){
dv[u].pb(v);
for(ll i=0;i<n;i++) df[i]=0;
bool ok=dfs(0);
if(ok==false){
return 1;
}
else{
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... |