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 "cave.h"
using namespace std;
void exploreCave(int N) {
int* S = new int[N];
int* D = new int[N];
for (int i = 0; i < N; ++i) {
S[i] = 0;
}
vector<bool> done(N);
for (int i = 0; i < N; ++i) {
int last = tryCombination(S);
int l = 0, r = N - 1;
while (l < r) {
int mid = (l + r) >> 1;
for (int i = l; i <= mid; ++i) {
if (!done[i]) {
S[i] = !S[i];
}
}
int now = tryCombination(S);
if ((last == i) == (now == i)) {
l = mid + 1;
} else {
r = mid;
}
last = now;
}
if (last == i) {
S[r] = !S[r];
}
D[r] = i;
done[r] = true;
}
answer(S, D);
}
# | 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... |