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>
void exploreCave(int n) {
using namespace std;
vector s(n, 0), d(n, -1);
auto solve = [&](int door_id) {
const auto correct {static_cast<int>(tryCombination(s.data()) == door_id)};
const auto wrong {1 - correct};
int lo = 0, hi = n;
while (lo != hi) {
const auto mid {(lo + hi) >> 1};
transform(d.begin(), d.end(), s.begin(), [&](const auto& x) { return x == -1 ? correct : wrong; });
tryCombination(d.data()) == door_id ? hi = mid : lo = mid + 1;
}
s[lo] = correct;
d[lo] = door_id;
};
for (int i = 0; i < n; ++i) {
solve(i);
}
// for (const auto& i : views::iota(0, n)) {
// solve(i);
// }
answer(s.data(), d.data());
}
# | 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... |