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>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
using namespace std;
bool jump(int x);
void escape(int N){
if(!jump(0)){
jump((N+1)/2);
}
ll comeback = 0;
for(int i = 30; i >= 0; i--){
if((1ll << i) > N) continue;
ll dist = (comeback + (1ll<<i)) % N;
comeback = 0;
if(jump(dist)){
continue;
}
comeback += N - (1ll<<i);
}
if(comeback){
ll dist = comeback % N;
jump(dist);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |