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"
#define M 5000
void exploreCave(int N) {
bool ch[N];
int s[N],a[N],i,j;
for(i=0;i<N;i++){
ch[i]=false;
s[i]=0;
a[i]=0;
}
for(i=0;i<N;i++){
int p,p2=tryCombination(s);
int st,ed,mi;
for(st=0,ed=N-1;st<ed;((p==i)^((p2=tryCombination(s))==i)) ? st=mi+1 : ed=mi){
p=p2;
mi=(st+ed)/2;
for(j=mi+1;j<=ed;j++) if(!ch[j]) s[j]=!s[j];
}
if(p2==i) s[st]=!s[st];
ch[st]=true;
a[st]=i;
}
answer(s,a);
}
# | 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... |