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;
bool good[1502];
set <int> dd[1502];
void initialize (int N) {
n = N;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i != j) {
dd[i].insert(j);
}
}
good[i] = 0;
}
}
void add_edge (int x, int y) {
dd[x].erase(y); dd[y].erase(x);
}
int hasEdge (int u, int v) {
if (good[u] && good[v]) {
return 0;
}
if (dd[u].size() == 1) {
add_edge(u, v);
good[u] = 1;
return 1;
}
if (dd[v].size() == 1) {
add_edge(u, v);
good[v] = 1;
return 1;
}
add_edge(u, 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... |