Submission #133175

#TimeUsernameProblemLanguageResultExecution timeMemory
133175mlyean00Gap (APIO16_gap)C++14
30 / 100
57 ms3836 KiB
#include "gap.h"

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll findGap(int T, int N) {
    ll ans = 0;

    ll mn = 0;
    ll mx = 1'000'000'000'000'000'000LL;
    vector<ll> a(N);
    for (int i = 0; i < (N + 1) / 2; ++i) {
        MinMax(mn, mx, &a[i], &a[N - 1 - i]);
        mn = a[i] + 1;
        mx = a[N - 1 - i] - 1;
    }

    for (int i = 1; i < N; ++i) {
        ans = max(ans, a[i] - a[i - 1]);
    }

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