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>
using namespace std;
#include "cave.h"
void exploreCave(int n) {
auto query = [&](vector<int> x, int fill, int lim) {
for (int i = 0; i < n; ++i) {
if (x[i] == -1) x[i] = i < lim ? !fill : fill;
}
int ret = tryCombination(x.data());
return ret == -1 ? n : ret;
};
vector<int> s(n, -1);
vector<int> d(n, -1);
for (int i = 0; i < n; ++i) {
int fill = query(s, 0, 0) > i;
int l = 1, r = n;
while (l < r) {
int m = (l + r) / 2;
if (query(s, fill, m) > i) r = m;
else l = m + 1;
}
s[l - 1] = !fill;
d[l - 1] = 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... |