# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148048 | GodTe | Cave (IOI13_cave) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
void exploreCave(int N){
int ans[5010] = {0,};
int cntd[5010] = {0,};
rep(i,5010){
ans[i] = 0; cntd[i] = -1;
}
rep(i,N){
int l = 0; int r = N-1;
while(l < r){
int mid = (l+r)/2;
for(int j = l; j <= mid; j++){
if(cntd[j] == -1) ans[j] = 1-ans[j];
}
if(tryCombination(ans) > i) r = mid;
else {
for(int j = l; j <= r; j++) if(cntd[j] == -1) ans[j] = 1-ans[j];
l = mid+1;
}
}
cntd[l] = i;
}
answer(ans,cntd);
}