Submission #1049186

#TimeUsernameProblemLanguageResultExecution timeMemory
1049186Marco_EscandonGame (APIO22_game)C++17
60 / 100
4011 ms23884 KiB
//#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...