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 <vector>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
#define pb push_back
int strat = 0;
int i = 0;
int r = 0;
vi s1d(5, -1);
/*{
| 0: first question city 0
| 1: first question city 1
| 2: island 0
| 3: island 1
| 4: asked about second island? (0/1)
}*/
void initialize(int n) {
if (n==4) {
strat = 1;
s1d[4] = 0;
} else {
strat = 0;
}
r = n*(n-1) / 2;
}
int s1(int u, int v) {
if (v<u) swap(u, v);
if (i==1) {
s1d[0] = u; s1d[1] = v;
return 0;
} else if (i==2) {
if (u != s1d[0] && u != s1d[1] && v != s1d[0] && v != s1d[1]) {
return 0;
} else {
s1d[2] = u; s1d[3] = v;
return 1;
}
} else {
if (s1d[2] == -1) {
s1d[2] = u; s1d[3] = v;
return 1;
}
else if (u == s1d[2] && v == s1d[3]) {
s1d[4] = 1;
return 1;
} else if (s1d[4] == 1) {
return 0;
} else {
return i == r - 1;
}
}
}
int hasEdge(int u, int v) {
i++;
if (strat == 1) return s1(u, v);
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... |