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"
int calc(int targ, int diff, int n){
return ((targ-diff)%n+n)%n;
}
void escape(int n) {
int diff = 0;
int l=0, r=n-1, res=-1;
while(l<=r){
int mid = (l+r)/2;
int steps = calc(mid, diff, n);
diff = (diff+steps)%n;
bool x = jump(steps);
if(x) res = mid, l = mid+1;
else r = mid-1;
}
jump(calc(res, diff, n));
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... |