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>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll ma,L,R,gm,i,LT,RT,a[101010];
vector<ll> v;
long long findGap(int T, int N)
{
if(T==1)
{
LT=-1;
RT=1e18;
RT++;
for(i=1;i<=(N+1)/2;i++)
{
MinMax(LT+1,RT-1,<,&RT);
a[i]=LT;
a[N-i+1]=RT;
}
for(i=2;i<=N;i++)
ma=max(ma,a[i]-a[i-1]);
}
else
{
MinMax(0,(ll)1e18,&L,&R);
gm=(R-L)/(N-1);
for(i=L;i<R;i+=(gm+1))
{
MinMax(i,min(i+gm,R),<,&RT);
if(LT!=-1)
v.pb(LT);
if(LT!=RT)
v.pb(RT);
}
for(i=1;i<v.size();i++)
ma=max(ma,v[i]-v[i-1]);
}
return ma;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=1;i<v.size();i++)
~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |