# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111544 | aleksam | Gap (APIO16_gap) | C++14 | 0 ms | 0 KiB |
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 "gap.h"
#define LLMAX 1000000000000000000LL
long long findGap(int T, int N)
{
assert(N<250);
long long apsmin, apsmax;
MinMax(0, LLMAX, &apsmin, &apsmax);
long long g=1, gg=1;
long long last=apsmin;
while(1){
long long mn, mx;
MinMax(last+1, last+g, &mn, &mx);
if(mn==-1){
g*=2;
continue;
}
if(mn-last>gg){
gg=mn-last;
g=gg;
}
last=mx;
if(mx==apsmax)break;
}
return gg;
}