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;
int nodes, edges = 0, questions;
std::vector<int> to_ask;
std::vector<bool> connected;
void initialize(int n) {
nodes = n;
questions = n*(n-1)/2;
to_ask.assign(n, n-1);
connected.assign(n, false);
}
int hasEdge(int u, int v) {
if(questions<=nodes-edges-1 or (to_ask[u]==1 and !connected[u]) or (to_ask[v]==1 and !connected[v])) {
to_ask[u]--;
to_ask[v]--;
connected[u] = true;
connected[v] = true;
edges++;
questions--;
return 1;
}
else {
to_ask[u]--;
to_ask[v]--;
questions--;
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... |