# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632778 | dozer | 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"
long long findGap(int T, int N)
{
long long l, r;
MinMax(1, 1e18, l, r);
long long lim = (r - l + 1 + N - 1) / N;
long long ans = lim, curr = l;
while(l != r)
{
long long a, b;
MinMax(curr + 1, curr + lim, &a, &b);
if (a == -1) curr += lim;
else
{
ans = max(ans, a - l);
l = a;
curr = a;
}
}
return ans;
}