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 s[N];
int d[N];
for(int i=0; i<N; i++){d[i]=-1;}
for(int i=0; i<N; i++){
int l=0;
int r=N-1;
int test[N];
for(int i=0; i<N; i++){test[i]=0;}
for(int i=0; i<N; i++){if(d[i]!=-1){test[i]= s[i];}}
int lol= tryCombination(test);
while(l<=r){
int mid= l+(r-l)/2;
for(int j=mid; j<=r; j++){if(d[j]==-1){test[j]+= 1; test[j]%=2;}}
int loll= tryCombination(test);
if(lol==i){
if(loll>lol){
l= mid;
}else{
r= mid-1;
}
}else{
if(loll==i){
l= mid;
}else{
r= mid-1;
}
}
}
d[l]=i;
if(lol==i){s[l]=1;}else{s[l]=0;}
}
answer(s, 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... |