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 ans=0;
long long mn,mx;
long long findGap(int T, int N)
{
if(T>=1)
{
long long l=0,r=1000000000000000000LL,prevmn=-1,prevmx=-1;
int rem=N;
long long ans=0;
while(rem>0)
{
MinMax(l,r,&mn,&mx);
if(rem==2)ans=max(ans,mn-mx);
if(prevmn!=-1)
{
ans=max(ans,mn-prevmn);
ans=max(ans,prevmx-mx);
}
if(mn!=mx)rem-=2;
else rem--;
prevmn=mn;
prevmx=mx;
}
return ans;
}
else
{
}
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
34 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |