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"
void exploreCave(int n) {
int res[n], s[n], d[n];
for(int i = 0; i < n; i++)
res[i] = -1;
for(int pos = 0; pos < n; pos++){
for(int i = 0; i < n; i++)
s[i] = (res[i] != -1? res[i] : 0);
int trueVal = (tryCombination(s) == pos);
int l = 0, r = n - 1;
while (l < r){
int mid = (l + r) >> 1;
for(int i = 0; i < n; i++)
if (res[i] != -1)
s[i] = res[i];
else if (l <= i && i <= mid)
s[i] = trueVal;
else
s[i] = trueVal ^ 1;
if (tryCombination(s) != pos)
r = mid;
else
l = mid + 1;
}
res[l] = trueVal;
d[l] = pos;
}
answer(res, 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... |