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<bits/stdc++.h>
#include "gap.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;
const int NN = 1e5 + 10;
ll a[NN];
ll findGap(int T, int N) {
ll mn, mx;
ll _max = 0;
MinMax(0LL, (ll)1e18, &mn, &mx);
a[1] = mn, a[N] = mx;
int i = 1;
while (1) {
MinMax(a[i]+1, a[N-i+1]-1, &mn, &mx);
if (mn == -1 && mx == -1) break;
if (mn == mx) {
a[i+1] = mn;
break;
}
a[i+1] = mn;
a[N-i] = mx;
i++;
if(i > N-i+1) break;
}
for (int i = 1; i < N; ++i) {
_max = max(_max, a[i+1]-a[i]);
}
return _max;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |