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"
int combo[5005];
int base[5005];
int door[5005];
int n;
bool check(int len,int target){
for(int i=0;i<n;i++){
combo[i]=base[i];
if(i<len&&door[i]==-1){
combo[i]^=1;
}
}
return tryCombination(combo)!=target;
}
void exploreCave(int N) {
n=N;
for(int i=0;i<N;i++){
door[i]=-1;
}
for(int i=0;i<N;i++){
if(tryCombination(base)!=i){
for(int j=0;j<N;j++){
if(door[j]==-1){
base[j]^=1;
}
}
}
int low=0,high=N;
while(high-low>1){
int mid=(low+high)/2;
if(check(mid,i)){
high=mid;
}else{
low=mid;
}
}
door[low]=i;
base[low]^=1;
}
answer(base,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... |