Submission #712701

#TimeUsernameProblemLanguageResultExecution timeMemory
712701tht2005Gap (APIO16_gap)C++17
0 / 100
45 ms1104 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 = 0;
        for(int l = 1, r = N; 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:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...