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 <bits/stdc++.h>
#include "game.h"
using namespace std;
#ifdef B01
#include "../deb.h"
#else
#define deb(...)
#endif
const int N = 2003;
int n;
int cntGiven;
int g[N][N];
int deg[N];
void initialize(int n_) {
n = n_;
memset(g, -1, sizeof g);
memset(deg, 0, sizeof deg);
cntGiven = 0;
}
int hasEdge(int u, int v) {
if (g[u][v] == -1) {
++deg[u];
++deg[v];
cntGiven += (deg[u] == n) + (deg[v] == n);
if (cntGiven < n - 2) {
if (deg[v] == n || deg[u] == n) {
g[u][v] = g[v][u] = 1;
} else if (deg[v] == n - 1 || deg[u] == n - 1) {
g[u][v] = g[v][u] = 1;
}
} else {
if (deg[v] == n || deg[u] == n) {
g[u][v] = g[v][u] = 1;
}
}
}
return g[u][v];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |