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<iostream>
using namespace std;
long long findGap(int T, int N)
{
long long mn, mx, i, j;
long long a[N+1];
MinMax(0,1000000000000000000, &mn, &mx);
a[1] = mn; a[N] = mx;
i = 1; j = N;
while ( mn != -1 && mx != -1 ) {
MinMax(mn+1, mx-1, &mn, &mx);
i ++; j --;
if ( mn == -1 ) break;
a[i] = mn; a[j] = mx;
}
long long diff = 0;
for ( i = 1; i < N; i ++ ) {
diff = max(diff, a[i+1] - a[i]);
}
return diff;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |