# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655327 | benjaminkleyn | Gap (APIO16_gap) | C++17 | 0 ms | 0 KiB |
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>
using namespace std;
typedef long long ll;
ll a[100000];
ll findGap(int T, int N)
{
ll lo = 0, hi = 1000000000000000000;
int l = 0, r = N - 1;
while (l <= r)
{
MinMax(lo, hi, a[l], a[r]);
lo = a[l--] + 1;
hi = a[r--] - 1;
}
ll mx = 0;
for (int i = 0; i < N; i++)
mx = max(mx, a[i+1] - a[i]);
return mx;
}