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 "cycle.h"
void escape(int n) {
long long a,b,c,d;
if (!jump(0)){
jump(n/2);
}
a=0;
b=n/2;
c=0;
while (b-a>1){
d=(a+b)/2-c;
if (d<0){d+=n;}
c=(a+b)/2;
if (jump(d)){
a=c;
}else{
b=c-1;
}
}
if (a==b){
d=a-c;
if (d<0){d+=n;}
jump(d);
}else{
d=b-c;
if (d<0){d+=n;}
if (!jump(d)){
jump(n-1);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |