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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
bool can;
int cur;
void escape(int n) {
can = jump(0);
if (can) {
int lower = 0, upper = n/2+1;
while (upper - lower > 1) {
int mid = (upper + lower)/2;
if (jump((mid-cur+n)%n)) lower = mid;
else upper = mid;
cur = mid;
}
} else {
int lower = -1, upper = n/2;
while (upper - lower > 1) {
int mid = (upper + lower)/2;
if (jump((mid-cur+n)%n)) upper = mid;
else lower = mid;
cur = mid;
}
jump((upper-cur+n+n/2)%n);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |