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"
#include <cassert>
void escape(int n) {
int pow2 = 1;
while (2 * pow2 <= n) pow2 *= 2;
pow2 /= 2;
if (!jump(0)) assert(jump(n / 2));
bool last_ok = true;
for (; pow2 > 0; pow2 /= 2) {
if (last_ok)
last_ok = jump(pow2);
else
last_ok = jump(n - pow2);
}
if (!last_ok) jump(n - 1);
return;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |