# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1134938 | Hamed_Ghaffari | Gap (APIO16_gap) | C++20 | 43 ms | 1212 KiB |
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;
long long findGap(int T, int N) {
ll mn, mx;
MinMax(0, 1e18, &mn, &mx);
ll lb = (mx-mn+N-2)/(N-1);
ll ans = lb, lst=mn;
for(ll i=mn; i<=mx; i += lb+1) {
ll x, y;
MinMax(i, min(i+lb, mx), &x, &y);
if(x!=-1) {
ans = max(ans, x-lst);
lst = y;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |