#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int added = 0;
int remain;
vector<int> vi;
void initialize(int n) {
::n = n;
remain = n * (n - 1) / 2;
vi = vector<int>(n, n - 1);
}
int hasEdge(int u, int v) {
remain--;
if (vi[u] == 1 || vi[v] == 1) {
added++;
vi[u] = 0, vi[v] = 0;
return 1;
} else if (added + remain + 1 == n - 1) {
added++;
return 1;
} else {
vi[u]--, vi[v]--;
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... |