Submission #702243

#TimeUsernameProblemLanguageResultExecution timeMemory
702243ld_minh4354Game (APIO22_game)C++17
30 / 100
4083 ms9852 KiB
#include<bits/stdc++.h> using namespace std; vector<int> adj[300005]; int st[300005],N,ans,K; void dfs(int u) { // cout<<u<<" "; if (st[u]!=0) { if (st[u]==1 and u<K) ans=1; return; } st[u]=1; for (auto v:adj[u]) dfs(v); st[u]=2; } void init(int n, int k) { N=n;K=k; for (int i=1;i<k;i++) adj[i-1].push_back(i); } int add_teleporter(int u, int v) { adj[u].push_back(v); sort(adj[u].begin(),adj[u].end()); ans=0; for (int i=0;i<N;i++) st[i]=0; dfs(0); // cout<<"\n"; return ans; }
#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...