# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
245398 | neihcr7j | Gap (APIO16_gap) | C++14 | 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>
#include "gap.h"
#define maxn 100005
using namespace std;
typedef long long ll;
ll findGap(int T, int n) {
ll l = 0, r = 1000000000000000000;
int i = 1, j = n;
vector < ll > a(n + 1);
while (i <= j) {
ll x, y;
MinMax(l, r, &x, &y);
a[i] = x;
a[j] = y;
i ++;
j --
l = x + 1;
r = y - 1;
}
ll ma = 0;
for (int i = 2; i <= n; ++i)
ma = max(ma, a[i] - a[i - 1]);
return ma;
}