# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
712705 | hoainiem | Gap (APIO16_gap) | C++14 | 44 ms | 1988 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 nmax 100008
const long long inf = 1e18 + 8;
using namespace std;
long long findGap(int T, int n)
{
long long ans = -1, a[nmax];
a[0] = -1;
a[n + 1] = inf;
for (int i = 1, j = n; i <= j; i++, j--){
if (i < j)
MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[j]);
else
MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[n + 2]);
}
for (int i = 1; i < n; i++)
assert(a[i] != -1);
for (int i = 1; i < n; i++)
ans = max(ans, a[i + 1] - a[i]);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |