Submission #820148

#TimeUsernameProblemLanguageResultExecution timeMemory
820148thimote75Game (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...