제출 #993545

#제출 시각아이디문제언어결과실행 시간메모리
993545thelegendary08게임 (APIO22_game)C++17
0 / 100
2 ms7512 KiB
#include "game.h" #include<bits/stdc++.h> #define pb push_back using namespace std; const int mxn = 300005; vector<int>adj[mxn]; vector<bool>vis(mxn, 0); int n,k; bool ans; void dfs(int x){ //cout<<x<<'\n'; if(ans)return; if(vis[x]){ if(x < k){ //cout<<x<<"k"<<'\n'; ans = 1; } return; } vis[x] = 1; for(auto u : adj[x])dfs(u); } void init(int N, int K) { n = N; k = K; for(int i = 0; i<k-1; i++)adj[i].pb(i+1); } int add_teleporter(int u, int v) { ans = 0; adj[u].pb(v); for(int i = 0;i<n;i++)vis[i] = 0; dfs(0); //cout<<ans<<'\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...