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"
const int MAXN = 5e3 + 5;
int bit[MAXN], door[MAXN], vis[MAXN];
void exploreCave(int n){
for(int i=0; i<n; ++i){
int ret = tryCombination(bit), lo = 0, hi = n - 1, mid, pos;
while(lo < hi){
mid = (lo + hi)>>1;
for(int j=lo; j<=mid; ++j) if(!vis[j]) bit[j] ^= 1;
pos = ret;
ret = tryCombination(bit);
if(pos == i || ret == i) hi = mid;
else lo = mid + 1;
}
if(ret == i) bit[lo] ^= 1;
door[lo] = i, vis[lo] = 1;
}
answer(bit, door);
}
# | 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... |