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 "vector"
#include <cmath>
using namespace std;
long long findGap(int T, int N)
{
vector<long long>a(N);
long long i=0;
long long int hi=1e18,low=0;
long long int s=low,t=hi;
MinMax(low,hi,&s,&t);
a[i]=s;
low=s+1;
a[N-1-i]=t;
hi=t;
i++;
while(i<(N-1)){
MinMax(low,hi,&s,&t);
if(s==t){
if(s<0)continue;
a[i]=t;
break;
}
else{
a[i]=s;
low=s+1;
}
i++;
}
long long int x=0;
for(int k=0;k<N-1;k++){
if(x<(a[k+1]-a[k]))x=a[k+1]-a[k];
}
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |