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 "cave.h"
#include <bits/stdc++.h>
const int N = 5005;
int m, now, a[N], b[N], has[N];
int was[N];
int get(void) {
int res = tryCombination(a);
return res;
}
void Switch(int l, int r) {
for (int x = l; x <= r; x += 1)
a[x] ^= 1;
}
void Do(int x, int l, int r) {
if (l == r) {
a[has[l]] = (get() == x ? 0 : 1);
b[has[l]] = x;
return;
}
int m = (l + r) / 2;
Switch(l, m);
int nxt = get();
Switch(l, m);
if (now == x and nxt == x) {
Do(x, m + 1, r);
}
if (now == x and nxt != x) {
Do(x, l, m);
}
if (now != x and nxt == x) {
Do(x, l, m);
}
if (now != x and nxt != x) {
Do(x, m + 1, r);
}
}
void exploreCave(int n) {
for (int i = 0; i < n; i += 1) {
m = 0;
for (int j = 0; j < n; j += 1) if (not was[j]) {
has[m++] = j;
}
now = get();
Do(i, 0, m - 1);
}
answer(a, b);
}
#ifdef ILOVELAMTER
int main(void) {
return 0;
}
#endif // ILOVELAMTER
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |