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;
typedef long long ll;
ll n,k,pl=0;
vector<vector<ll>> cad(300005);
vector<ll> dp(300005,-1);
void dfs(ll node, ll val)
{
if(node<k&&val>=dp[node]) pl=1;
if(pl) return;
if(dp[node]<val) dp[node]=val;
else return;
for(auto i:cad[node])
dfs(i,val);
}
void init(int N, int K) {
n=N;
k=K;
for(int i=0; i<k; i++) {dp[i]=i;if(i!=k-1)cad[i].push_back(i+1);}
}
int add_teleporter(int u, int v) {
if(v<=u||v>=k) {cad[u].push_back(v);dfs(v,dp[u]);}
return pl;
}
# | 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... |