제출 #774034

#제출 시각아이디문제언어결과실행 시간메모리
774034danikoynovGame (IOI14_game)C++14
42 / 100
1084 ms3364 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1510; int n; int edge[maxn][maxn], used[maxn]; void initialize(int N) { n = N; for (int i = 0; i < n; i ++) for (int j = 0; j < n; j ++) { if (i != j) edge[i][j] = edge[j][i] = 1; } } void dfs(int v) { used[v] = 1; for (int u = 0; u < n; u ++) { if (!used[u] && edge[v][u] > 0) dfs(u); } } int hasEdge(int u, int v) { edge[u][v] = edge[v][u] = 0; for (int i = 0; i < n; i ++) used[i] = 0; dfs(0); //for (int i = 0; i < n; i ++) // cout << used[i] << endl; for (int i = 0; i < n; i ++) { if (used[i] == 0) { edge[u][v] = edge[v][u] = 1; return 1; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...