제출 #1108334

#제출 시각아이디문제언어결과실행 시간메모리
1108334Ariadna게임 (IOI14_game)C++14
0 / 100
1 ms508 KiB
#include <bits/stdc++.h> #define fi first #define se second using namespace std; int n; vector<vector<int>> edge, con; int aux = 0; void initialize(int N) { n = N; edge = con = vector<vector<int>>(n, vector<int>(n, 0)); } int hasEdge(int u, int v) { for (int i = 0; i < n; ++i) { ++edge[u][i]; ++edge[i][u]; ++edge[v][i]; ++edge[i][v]; } if (edge[u][v] == 2) { for (int i = 0; i < n; ++i) { if (i != v) { ++con[i][u]; ++con[u][i]; } else if (i != u) { ++con[i][v]; ++con[v][i]; } } return 1; } bool ok1 = true; for (int i = 0; i < n; ++i) { if (i == v) continue; if (edge[i][v] == 2*(n-1) && !con[i][v]) { ok1 = false; } } bool ok2 = true; for (int i = 0; i < n; ++i) { if (i == u) continue; if (edge[i][u] == 2*(n-1) && !con[i][u]) { ok2 = false; } } if (!ok1 || !ok2) { for (int i = 0; i < n; ++i) { ++edge[u][i]; ++edge[i][u]; ++edge[v][i]; ++edge[i][v]; if (i != v) { ++con[i][u]; ++con[u][i]; } else if (i != u) { ++con[i][v]; ++con[v][i]; } } return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...