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"
void escape(int n) {
if(n==2)
{
jump(1);
return;
}
int cur=0;
auto qry=[&](int a)
{
int x=(a-cur+n)%n;
cur=a%n;
return jump(x);
};
if(!qry(0))
cur=n-(1+n/2);
int ans=0;
for(int i=29;i>=0;i--)
if(qry(ans+(1<<i)))
ans+=(1<<i);
qry(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |