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;
void escape(int N){
int cur = 0;
int l = 0, r = N - 1;
bool pre = jump(0);
while(l + 1 < r){
int m = (l + r) / 2;
bool res;
if(cur > m){
res = jump(N - cur + m);
}else{
res = jump(m - cur);
}
cur = m;
if(res && pre){
if(m == N / 2){
r = m;
}else{
l = m;
}
}else if(pre && !res){
r = m - 1;
}else if(!pre && res){
l = m;
}else{
r = m - 1;
}
}
if(l == r){
if(cur > l){
jump(N - cur + l);
}else{
jump(l - cur);
}
}else{
if(cur > l){
jump(N - cur + l);
}else{
jump(l - cur);
}
if(jump(1)){
return;
}else{
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... |