Submission #456445

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4564452021-08-06 18:27:34nonsensenonsense1Gap (APIO16_gap)C++17
0 / 100
64 ms1108 KiB
#include "gap.h"
#include <cassert>
#include <algorithm>
const long long N = 1000000000000000000;
long long task1(int n)
{
long long l = 0, r = N, ans = 0;
for (int i = 0; i * 2 < n; ++i) {
long long ll, rr;
MinMax(l, r, &ll, &rr);
if (l) ans = std::max(ans, ll - l + 1);
if (r != N) ans = std::max(ans, r - rr + 1);
if (i * 2 == n - 2) ans = std::max(ans, rr - ll);
l = ll + 1;
r = rr - 1;
}
return ans;
}
inline long long d(int n, int k, long long l, long long r)
{
return l + (__int128)(r - l) * k / n;
}
long long task2(int n)
{
long long l, r;
MinMax(0, N, &l, &r);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...