Submission #838530

#TimeUsernameProblemLanguageResultExecution timeMemory
838530tch1cherinGap (APIO16_gap)C++17
0 / 100
37 ms3160 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long findGap(int T, int N) { long long Min = -1, Max = 1e18l + 1; vector<long long> front, back; while (Min + 1 <= Max - 1) { MinMax(Min + 1, Max - 1, &Min, &Max); if (Min != Max) { front.push_back(Min); back.push_back(Max); } } reverse(back.begin(), back.end()); vector<long long> A; for (auto v : front) { A.push_back(v); } for (auto v : back) { A.push_back(v); } long long gap = 0; for (int i = 0; i < N - 1; i++) { gap = max(gap, A[i + 1] - A[i]); } return gap; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...