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(int T, int N){
long long l=0;
long long r=1e18;
long long mn,mx;
long long ans=0;
long long a=0,b=0;
MinMax(l,r, &mn, &mx);
a=mn;
l=mn+1;
b=mx;
r=mx-1;
N-=2;
while(l<=r)
{
if(N<=0)break;
MinMax(l,r, &mn, &mx);
ans=max(ans, mn-a);
ans=max(ans, b-mx);
a=mn;
l=mn+1;
b=mx;
r=mx-1;
N-=2;
}
ans=max(ans, abs(a-b));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |