# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225901 | pavement | Lost in the cycle (IOI19_cycle) | C++17 | 0 ms | 0 KiB |
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>
using namespace std;
void escape(int n) {
int cur = 0, lo = 0, hi = n - 1, ans = -1;
while (lo <= hi) {
int mid = (lo + hi) >> 1;
bool x = jump(mid >= cur ? mid - cur : n - cur + mid);
cur = mid;
if (x) ans = mid, hi = mid - 1;
else lo = mid + 1;
}
jump((ans >= cur ? ans - cur : n - cur + ans) + n / 2);
}