This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |