# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109554 | PeppaPig | 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 "gap.h"
#include <bits/stdc++.h>
#define long long long
using namespace std;
const int N = 1e5+5;
long findGap(int T, int n) {
long l, r;
MinMax(0, 2e18, l, r);
if(T == 1) {
long ans = 0;
for(int i = 1; i < (n + 1) / 2; i++) {
long nl, nr;
MinMax(l + 1, r - 1, nl, nr);
if(nl != -1) ans = max(ans, nl - l), l = nl;
if(nr != -1) ans = max(ans, r - nr), r = nr;
}
return ans;
} else {
return 0;
}
}