제출 #982801

#제출 시각아이디문제언어결과실행 시간메모리
982801alo_54게임 (APIO22_game)C++17
0 / 100
1 ms344 KiB
//#include "game.h" #include <bits/stdc++.h> using namespace std; struct Nodo { vector <int> ady; bool special = false; }; vector <Nodo> g; vector <bool> vis; bool acPos = 0; int K; int dfs(int node) { // cout<<"call "<<node<<endl; vis[node] = true; int resp = 0; for (auto i : g[node].ady) { //cout<<"check "<<i<<endl; if (!vis[i]) { //cout<<"check "<<i<<endl; resp = dfs(i); }else { if (g[i].special) { //cout<<"si"<<endl; acPos = 1; resp = 1; } } } //cout<<"no"<<endl; return resp; } void init(int n, int k) { vis.resize(n); g.resize(n); K = k; for (int i = 0; i < k; i++) { g[i].special = true; } } int add_teleporter(int u, int v) { fill(vis.begin(), vis.end(), false); g[u].ady.push_back(v); int resp = acPos; for (int i = 0; i < K; i++) { resp = dfs(i); if (resp == 1) { acPos = true; break; } } if (acPos) { resp = true; } return resp; }
#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...