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<algorithm>
#include<cmath>
using namespace std;
long long findGap(int T, int N)
{
long long int mi,ma;
int n=N;
MinMax(1,1000000000000000,&mi,&ma);
long long int a[n+3];
//cout<<mi<<" "<<ma<<endl;
a[1]=mi;
a[n]=ma;
for(int i=2;i<=n/2;i++){
//cout<<1;
mi++;
ma--;
//cout<<" 22 "<<mi<<" "<<ma;
MinMax(mi,ma,&mi,&ma);
// cout<<mi<<" "<<ma<<endl;
a[i]=mi;
a[n-i+1]=ma;
}
mi++;
ma--;
if(n%2==1){
MinMax(mi,ma,&mi,&ma);
a[n/2+1]=mi;
}
long long int ans=0;
for(int i=2;i<=n;i++){
ans=max(ans,a[i]-a[i-1]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |