# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168229 | stdfloat | Gap (APIO16_gap) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "gap.h"
#include "grader.cpp"
using namespace std;
using ll = long long;
ll findGap(int T, int n) {
ll s, t;
MinMax(LLONG_MIN, LLONG_MAX, &s, &t);
ll x = s, mx;
int l = (t - s) / (n + 1);
while (s <= t) {
ll a, b;
MinMax(s, s + l, &a, &b);
if (~a) {
mx = max(mx, a - x);
x = b;
}
s += l + 1;
}
return mx;
}