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<bits/stdc++.h>
#include "cycle.h"
using namespace std;
int p=1,n=10;
/*bool jump(int x) {
p = (p + x) % n;
cout<<p<<endl;
return (n - p) % n <= n / 2;
}*/
void escape(int n){
int l=0,r=0;
if(jump(0)){
l=0;
r=n/2;
}
else{
l=n/2+1;
r=n-1;
}
int h=0;
while(r-l>1){
int mid=((l+r)/2);
jump(h);
h=n-(l+r)/2;
if(jump(mid))
l=(l+r)/2;
else
r=(l+r)/2;
}
jump(h);
if(jump(r))
return;
h=n-r;
jump(h);
jump(l);
return;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |