제출 #820148

#제출 시각아이디문제언어결과실행 시간메모리
820148thimote75게임 (IOI14_game)C++14
42 / 100
1093 ms544 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; using idata = vector<int>; using bdata = vector<bool>; using bgrid = vector<bdata>; bgrid roads; idata visited; int stage = 1; int N; void initialize(int _N) { N = _N; visited.resize(N, 0); roads .resize(N, bdata(N, true)); } bool dfs (int s, int t) { if (s == t) return true; if (visited[s] == stage) return false; visited[s] = stage; for (int i = 0; i < N; i ++) if (i != s && roads[s][i]) if (dfs(i, t)) return true; return false; } int hasEdge(int u, int v) { stage ++; roads[u][v] = false; roads[v][u] = false; if (dfs(u, v)) return 0; roads[u][v] = true; roads[v][u] = true; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...