Submission #712703

#TimeUsernameProblemLanguageResultExecution timeMemory
712703tht2005Gap (APIO16_gap)C++17
30 / 100
47 ms1172 KiB
#include "gap.h"
#include <vector>
#include <algorithm>

long long findGap(int T, int N) {
    if(T == 1) {
        long long LF, RT;
        MinMax(0, 1LL << 60, &LF, &RT);
        long long res = (N == 2) ? (RT - LF) : 0;
        for(int l = 1, r = N - 2; l <= r; ++l, --r) {
            long long LF_old = LF, RT_old = RT;
            MinMax(LF_old + 1, RT_old - 1, &LF, &RT);
            res = std::max(res, std::max(LF - LF_old, RT_old - RT));
            if(l + 1 == r) {
                res = std::max(res, RT - LF);
            }
        }
        return res;
    }
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...