#include "cycle.h"
void escape(int n) {
bool result = jump(1);
if(result!=1) jump(n/2);
long long pos = 0; long long Lpos = 0; long long Rpos = n/2; long long mid;
for(;;) {
mid = (Lpos+Rpos)/2;
if(Lpos==Rpos) {
return;
}
else if (pos > mid) result = jump(n-(pos-mid));
else result = jump(mid-pos);
if (result==1) Lpos = mid+1;
else Rpos = mid;
pos = mid;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
The exit was not found. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
The exit was not found. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
The exit was not found. |
4 |
Halted |
0 ms |
0 KB |
- |