제출 #93836

#제출 시각아이디문제언어결과실행 시간메모리
93836Alexa2001게임 (IOI14_game)C++17
42 / 100
1081 ms1396 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int Nmax = 1505; bool edge[Nmax][Nmax], used[Nmax]; int n; void initialize(int N) { n = N; int i, j; for(i=0; i<n; ++i) for(j=0; j<n; ++j) edge[i][j] = (i != j); } void dfs(int node) { used[node] = 1; for(int i = 0; i<n; ++i) if(!used[i] && edge[node][i]) dfs(i); } int hasEdge(int u, int v) { int i; for(i=0; i<n; ++i) used[i] = 0; edge[u][v] = edge[v][u] = 0; dfs(0); bool ok = 1; for(i=0; i<n; ++i) ok &= used[i]; if(!ok) edge[u][v] = edge[v][u] = 1; return (ok ^ 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...