#include <bits/stdc++.h>
#include "game.h"
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
const ll n_ = 3e5 + 100;
ll checked[n_], x, y;
void initialize(int n) {
}
int hasEdge(int u, int v) {
if (checked[u] && checked[v]) {
return checked[u] = checked[v] ? 1 : 0;
}
else if (checked[u]) {
if (x <= y) checked[v] = 1;
else checked[v] = 2;
return checked[u] = checked[v] ? 1 : 0;
}
else if (checked[v]) {
if (x <= y) checked[u] = 1;
else checked[u] = 2;
return checked[u] = checked[v] ? 1 : 0;
}
else {
if (x < y) {
checked[u] = checked[v] = 1;
x += 2;
return 1;
}
else if (y < x) {
checked[u] = checked[v] = 2;
y += 2;
return 1;
}
else {
checked[u] = 1, checked[v] = 2;
x++, y++;
return 0;
}
}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |