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>
#include "cycle.h"
using namespace std;
int n;
void solve(int idx, int fl) {
//cerr << idx << " " << fl << "\n";
idx %= n;
if (idx == (fl^1)) {
if (idx) jump(n-idx);
return;
}
if (fl) {
int x = n - idx + 1;
if (jump(x / 2))
solve(idx + x / 2, 1);
else
solve(x / 2, 0);
} else {
int x = idx;
if (jump(n-idx + x/2))
solve(n - (x+1)/2 + 1, 1);
else
solve(x/2, 0);
}
}
void escape(int x) {
n = x;
if (jump(0))
solve(n-n/2, 1);
else
solve(n-(n/2+1), 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |