제출 #712714

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7127142023-03-19 14:18:25tht2005Gap (APIO16_gap)C++17
100 / 100
62 ms6420 KiB
#include "gap.h"
#include <vector>
#include <algorithm>
#include <iostream>
#include <utility>
long long findGap(int T, int N) {
if(N == 1) {
return 0;
}
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;
}
long long LF, RT;
MinMax(0, 1LL << 60, &LF, &RT);
if(N == 2) {
return RT - LF;
}
long long BLK = (RT - LF + 1) / (N - 1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...