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<iostream>
#include<algorithm>
#include "gap.h"
using namespace std;
long long findGap(int T, int N)
{
if(T==2)return 69LL;
long long l=-1,r=1000000000000000001;
long long mn,mx;
int rem=N;
long long ans=1;
while(rem>0)
{
MinMax(l+1,r-1,&mn,&mx);
if(rem==2)ans=max(ans,mx-mn);
if(l!=-1)
{
ans=max(ans,mn-l);
ans=max(ans,r-mx);
}
if(mn!=mx)rem-=2;
else rem--;
l=mn;
r=mx;
}
if(T==1)return ans;
else return 69;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |