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"
#define de(x) if( x && x == MODE)
#define MODE 0
int N;
int now;
void BS( int L, int R)
{
de(1) printf("( %d, %d)\n", L, R);
int M = ( L + R + 1) / 2;
bool q;
int j;
if( now <= M)
{
j = M - now;
}
else
{
j = N - now + M;
}
q = jump( j);
de(1) printf("jump(%d)\n", j);
now = M;
de(1) printf("pos. %d\n", now);
if( L == R)
return;
if(q)
BS( M, R);
else
BS( L, M-1);
}
void escape(int n) {
now = 0;
N = n;
if( !jump(0) )
{
de(1) printf("jump(%d)\n", N/2);
jump(N/2);
}
else
{
if( !jump(1) )
{
jump(n-1);
return;
}
jump(n-1);
}
BS( 0, n-1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |