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>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAX=1e6;
const ll INF=1e17;
const ll mod=1e9+7;
bool mover(int&pos, int end, int n){
bool ans;
//cout<<pos<<' '<<end<<'\n';
if(pos<=end)ans=jump(end-pos);
else{
//cout<<n<<' '<<pos<<' '<<end<<'\n';
ans=jump(n-pos+end);
}
pos=end;
return ans;
}
void escape(int n) {
bool first=jump(0);
int pos=0;
int lo=0,hi=n/2+1;
while(lo+1!=hi){
ll mid=(lo+hi)/2;
if(mover(pos, mid, n)==first){
lo=mid;
}
else{
hi=mid;
}
}
if(first){
mover(pos, lo, n);
}
else{
mover(pos,hi+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... |