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>
using namespace std;
void exploreCave(int N) {
int S[N], D[N];
vector<int> left(N);
iota(left.begin(), left.end(), 0);
for (int i = 0; i < N; i++) {
for (auto& x : left) S[x] = 1;
int b = tryCombination(S) == i;
for (auto& x : left) S[x] = !b;
int lo = 0, hi = (int) left.size() - 1;
while (lo < hi) {
int mid = lo + (hi - lo) / 2;
for (int j = lo; j <= mid; j++) S[left[j]] = b;
if (tryCombination(S) == i) hi = mid;
else lo = mid + 1;
for (int j = lo; j <= mid; j++) S[left[j]] = !b;
}
S[left[lo]] = !b;
D[left[lo]] = i;
left.erase(left.begin() + lo);
}
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... |