Submission #554402

#TimeUsernameProblemLanguageResultExecution timeMemory
554402gimabd30Gap (APIO16_gap)C++17
30 / 100
51 ms1864 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll findGap(int T, int N) { const ll inf = 1'000'000'000'000'000'000LL; if (T == 1) { vector<ll> a(N); ll mn = -1, mx = inf + 1; ll ans = -inf; for (int l = 0, r = N - 1; l <= r; ++l, --r) { MinMax(mn + 1, mx - 1, &mn, &mx); assert(mn != -1); a[l] = mn, a[r] = mx; } for (int i = 0; i < N - 1; ++i) { ans = max(ans, a[i + 1] - a[i]); } return ans; } else { return -1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...