# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636783 | lovrot | Gap (APIO16_gap) | C++11 | 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 "gap.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
ll niz[N];
ll findGap(int t, int n){
int minp = 0;
int maxp = n - 1;
ll mn = 0, minr;
ll mx = INF, maxr;
while(minp <= maxp){
MinMax(mn, mx, minr, maxr);
niz[minp] = minr;
niz[maxp] = maxr;
mn = minr + 1;
mx = maxr - 1;
minp++;
maxp--;
}
ll ans = 0;
for(int i = 0; i < n - 1; i++) ans = max(ans, niz[i + 1] - niz[i]);
return ans;
}