| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1331457 | AzeTurk810 | Game (IOI14_game) | C++20 | 0 ms | 352 KiB |
#include "game.h"
#include <algorithm>
#include <cassert>
#include <utility>
#include <vector>
int N;
std::vector<std::vector<int>> g, asked;
int cnt;
void initialize(int _n) {
N = _n;
g.resize(N, std::vector<int>(N));
for (int i = 1; i < N; i++) {
g[i][i - 1] = true;
}
asked.resize(N, std::vector<int>(N));
int cnt = N - 1;
}
int hasEdge(int u, int v) {
if (u > v)
std::swap(u, v);
assert(!asked[v][u]);
asked[v][u] = true;
if (g[v][u]) {
if (cnt == 1) {
bool ok = false;
for (int j = 0; j < N; j++) {
for (int i = j + 1; i < N; i++) {
if (asked[j][i] || g[j][i])
continue;
g[v][u] = false;
g[j][i] = true;
ok = true;
break;
}
if (ok)
break;
}
assert(ok);
return false;
} else {
cnt--;
return true;
}
}
return false;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
