제출 #400625

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4006252021-05-08 12:12:07FalconGap (APIO16_gap)C++17
100 / 100
69 ms1936 KiB
#include "gap.h"
#include <algorithm>
#include <iostream>
#include <vector>
#include <cassert>
long long findGap(int T, int N) {
if(T == 1) {
std::vector<long long> a; a.reserve(N);
long long s{0}, e{(long long)1e18};
while(int(a.size()) < N) {
MinMax(s, e, &s, &e);
assert(s != -1);
a.push_back(s); a.push_back(e);
++s, --e;
}
std::sort(a.begin(), a.end());
long long ans{};
for(int i{}; i < int(a.size()) - 1; ++i)
ans = std::max(ans, a[i + 1] - a[i]);
return ans;
}
long long a1{}, aN{};
MinMax(0, (long long)1e18, &a1, &aN);
long long d = (aN - a1 + N - 2) / (N - 1), ans = d;
for(long long i = a1, p = a1; i <= aN; i += d + 1) {
long long s{}, e{};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...