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"
void escape(int n) {
int le = 0, ri = n - 1;
if (jump(0)) ri = n / 2;
else le = n / 2 + 1;
int h = 0; // x : 목표 지점 h : 현 위치
while (ri - le >= 2) {
int mid = (le + ri) / 2;
bool r = jump((mid - h + n) % n);
h = (h + (mid - h + n) % n) % n;
if (r) le = mid;
else ri = mid - 1;
}
if (le == ri) {
jump((le - h + n) % n);
return;
}
if (le + 1 == ri) {
bool r = jump((ri - h + n) % n);
if (r) return;
else jump(n - 1);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |