# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
742614 | AndrijaM | 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"
#include <bits/stdc++.h>
using namespace std;
long long findGap(long long T, long long N)
{
long long l=0;
long long r=1e18;
long long mn,mx;
long long ans=0;
long long a,b;
MinMax(l,r,&mn,&mx);
a=mn;
l=mn+1;
b=mx;
r=mx-1;
while(l<r)
{
MinMax(l,r,&mn,&mx);
ans=max(ans, abs(a-mn));
ans=max(ans, abs(b-mx));
a=mn;
l=mn+1;
b=mx;
r=mx-1;
}
ans=max(ans, abs(a-b));
return ans;
}