Submission #48384

#TimeUsernameProblemLanguageResultExecution timeMemory
48384BTheroGap (APIO16_gap)C++17
30 / 100
87 ms2204 KiB
// Why am I so stupid? :c
#include <bits/stdc++.h>
#include "gap.h"

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

long long findGap(int t, int n) {
    ll arr[n + 5];

    arr[0] = 0, arr[n + 1] = (ll)1e18 + 1;
    int l = 1, r = n;

    while (l <= r) {
        MinMax(arr[l - 1] + 1, arr[r + 1] - 1, arr + l, arr + r);
        ++l, --r;
    }

    ll ret = 0;

    for (int i = 1; i < n; ++i) {
        ret = max(ret, arr[i + 1] - arr[i]);
    }

    return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...