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"
bool move(int& cur, int end, int n) {
bool ans;
if(cur <= end) ans = jump(end - cur);
else ans = jump(n + end - cur);
cur = end;
return ans;
}
void escape(int n) {
bool ini = jump(0);
int cur = 0;
int l = 0, r = n/2 + 1;
while(l + 1 < r) {
int m = (l + r) >> 1;
if(move(cur, m, n) == ini) l = m;
else r = m;
}
if(ini) move(cur, l, n);
else {
move(cur, r + n / 2, n);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |