#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
void escape(int n) {
int cur = 0, lo = 0, hi = n / 2, ans = -1;
if (jump(n - 1)) {
jump(1);
while (lo <= hi) {
int mid = (lo + hi) >> 1;
bool x = jump(mid <= cur ? cur - mid : n - llabs(cur - mid));
cur = mid;
if (x) ans = mid, lo = mid + 1;
else hi = mid - 1;
}
jump((ans <= cur ? cur - ans : n - llabs(cur - ans)) + n / 2);
} else {
jump(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);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
The exit was not found. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 KB |
The exit was not found. |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
The exit was not found. |
3 |
Halted |
0 ms |
0 KB |
- |