This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int>> g;
void initialize(int n) {
::n = n;
g.assign(n, vector<int>(n, -1));
for (int i = 0; i < n; i++) {
g[i][i] = 0;
}
}
int hasEdge(int u, int v) {
bool us, vs;
us = vs = 0;
int bu, bv;
bu = bv = 0;
for (int i = 0; i < n; i++) {
us = us || (g[u][i] == 1);
vs = vs || (g[v][i] == 1);
bu += (g[u][i] == -1);
bv += (g[v][i] == -1);
}
if (g[u][v] == -1 && (!us && !vs)) {
g[u][v] = g[v][u] = 1;
return 1;
}
g[u][v] = g[v][u] = 0;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |