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 <set>
using namespace std;
set<int> S[1505];
bool nott[1505];
void initialize(int n) {
for(int i = 0; i < n; ++i) for(int j = 0; j < n; ++j) if(i != j) {
S[i].emplace(j);
}
}
int hasEdge(int u, int v) {
bool st = S[u].size() <= 1 || S[v].size() <= 1;
if(S[u].count(v)) S[u].erase(v);
if(S[v].count(u)) S[v].erase(u);
if(st) nott[u] = nott[v] = true;
if(S[u].size() == 1 && nott[u] == false) {
int a = *S[u].begin();
if(S[a].count(u)) S[a].erase(u);
}
if(S[v].size() == 1 && nott[v] == false) {
int a = *S[v].begin();
if(S[a].count(v)) S[a].erase(v);
}
return st;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |