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>
using namespace std;
void exploreCave(int N){
int pos[N],ans[N];
vector<bool> vis(N);
memset(pos,0,sizeof(pos));
for(int i=0; i<N; i++){
int tmp=0,p=0;
if(tryCombination(pos)==i) tmp=1;
int l=0,r=N-1;
while(l<=r){
int m=l+(r-l)/2;
for(int z=0; z<=m; z++){
if(!vis[z]) pos[z]^=1;
}
if(tmp){
if(tryCombination(pos)==i) l=m+1,p=pos[r]^1;
else r=m-1,tmp^=1,p=pos[r];
}else{
if(tryCombination(pos)==i) r=m-1,p=pos[r]^1,tmp^=1;
else l=m+1,p=pos[r];
}
}
vis[l]=1;
ans[l]=i;
pos[l]=p;
}
answer(pos,ans);
}
# | 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... |