이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define maxn 300005
int n,k,low[maxn],high[maxn];
vector<int> AL[maxn],AL2[maxn];
void dfs(int u,int x){
for(int v:AL[u]){
if(high[v]<x){
high[v]=x;
dfs(v,x);
}
}
}
void dfs2(int u,int x){
for(int v:AL2[u]){
if(x<low[v]){
low[v]=x;
dfs2(v,x);
}
}
}
void init(int _n,int _k){
n=_n;k=_k;
for(int i=0;i<n;++i){
high[i]=-1;
low[i]=k;
}
for(int i=0;i<k-1;++i){
AL[i].pb(i+1);
AL2[i+1].pb(i);
}
}
int add_teleporter(int u,int v){
//if(v<=u&&u<k)return 1;
if(v<k)low[v]=min(low[v],v);
if(u<k)high[u]=max(high[u],u);
AL[u].pb(v);
AL2[v].pb(u);
dfs(u,high[u]);
dfs2(v,low[v]);
printf("low: ");
for(int i=0;i<n;++i)printf("%d ",low[i]);
printf("\n");
printf("high: ");
for(int i=0;i<n;++i)printf("%d ",high[i]);
printf("\n");
for(int u=0;u<n;++u){
if(low[u]<=high[u])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... |