이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int vt[300003],N,K;
vector<int>ad[300003];
bool dfs(int u,int vl=-1){
vt[u]=vl;
for(auto v:ad[u]){
if(v<=vl)return 1;
if(vt[v]<vl)
if(dfs(v,vl))return 1;
}
return 0;
}
void init(int n, int k) {
N=n,K=k,vt[k-1]=k-1;
for(int i=0;i<k-1;i++)
vt[i]=i,ad[i].push_back(i+1);
for(int i=k;i<n;i++)vt[i]=-1;
}
int add_teleporter(int u, int v){
ad[u].push_back(v);
int vl=vt[u];
if(v<=vl)return 1;
if(vt[v]<vl)return dfs(v,vt[u]);
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... |