제출 #711999

#제출 시각아이디문제언어결과실행 시간메모리
711999thimote75Game (IOI14_game)C++14
42 / 100
1087 ms392 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define graph vector<vector<bool>> graph n_roads; bool has_road (int a, int b) { return !n_roads[a][b]; } vector<int> visited; int stage = 0; int nbNodes; bool find (int pos, int target) { if (pos == target) return true; if (visited[pos] == stage) return false; visited[pos] = stage; for (int n = 0; n < nbNodes; n ++) if (has_road(pos, n) && find(n, target)) return true; return false; } void initialize(int n) { nbNodes = n; n_roads.resize(n, vector<bool>(n, false)); visited.resize(n, -1); } int hasEdge(int u, int v) { n_roads[u][v] = true; n_roads[v][u] = true; stage ++; if (find(u, v)) return 0; n_roads[u][v] = false; n_roads[v][u] = false; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...