제출 #577565

#제출 시각아이디문제언어결과실행 시간메모리
577565Mazaalai게임 (IOI14_game)C++17
42 / 100
1078 ms1108 KiB
#include "game.h" #include <bits/stdc++.h> #define lb lower_bound #define LINE "------------\n" using namespace std; using PII = pair <int, int>; const int N = 1500; bool path[N][N]; int n; void initialize(int _n) { n = _n; for (int i = 0; i < n; i++) for (int j = i+1; j < n; j++) path[i][j] = path[j][i] = 1; } int hasEdge(int u, int v) { path[u][v] = path[v][u] = 0; bool vis[n]; memset(vis, 0, sizeof(vis)); queue <int> bfs; bfs.push(u); vis[u] = 1; int reach = 0; while(!bfs.empty()) { reach++; int x = bfs.front(); bfs.pop(); for (int i = 0; i < n; i++) { if (path[x][i] && !vis[i]) { bfs.push(i); vis[i] = 1; } } } if (reach != n) path[u][v] = path[v][u] = 1; return reach != n; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...