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, 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[x] = (get() == x ? 1 : 0);
b[has[l]] = x;
return;
}
int m = (l + r) / 2;
int now = get();
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;
}
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... |