# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
956294 | | Nelt | Gap (APIO16_gap) | C++17 | | 1763 ms | 524288 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 ll long long
#define endl "\n"
using namespace std;
ll solve(ll l, ll r)
{
if (l == -1)
return 0;
ll mid = (l + r) >> 1, x, y, x1, y1;
MinMax(l, mid, &x, &y);
MinMax(l, mid, &x1, &y1);
return max({solve(x, y), solve(x1, y1), x1 - y});
}
ll findGap(int t, int n)
{
if (t == 1)
{
ll ans = 0;
ll a[n];
ll l = 0, r = 1e18, i = 0, j = n - 1;
while (i <= j)
{
MinMax(l, r, &a[i], &a[j]);
l = a[i++] + 1;
r = a[j--] - 1;
}
for (ll i = 0; i + 1 < n; i++)
ans = max(ans, a[i + 1] - a[i]);
return ans;
}
return solve(0, 1e18);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |