제출 #835063

#제출 시각아이디문제언어결과실행 시간메모리
835063_martynas게임 (IOI14_game)C++11
42 / 100
1082 ms2072 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int mxn = 1505; int n; bool resp[mxn][mxn], decided[mxn][mxn]; bool adj[mxn][mxn]; void initialize(int N) { n = N; } bool visited[mxn]; // check if it can be connected void dfs_could(int u) { visited[u] = true; for(int v = 0; v < n; v++) if(!visited[v]) { if(!decided[u][v] || adj[u][v]) { dfs_could(v); } } } int hasEdge(int u, int v) { resp[u][v] = resp[v][u] = true; decided[u][v] = decided[v][u] = true; fill(visited, visited+n, false); dfs_could(0); if(count(visited, visited+n, true) != n) { adj[u][v] = adj[v][u] = true; } // cerr << "adj:\n"; // for(int i = 0; i < n; i++) { // for(int j = 0; j < n; j++) { // cerr << adj[i][j]; // } // cerr << "\n"; // } return adj[u][v]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...