# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404454 | CursedCode | Gap (APIO16_gap) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int findGap(int t, int n){
long long L, R;
MinMax(0LL, 1e18, &L, &R);
long long x = (R - L + n - 2) / (n - 1);
long long ans = x;
long long last = L;
for(long long i = L + 1; i < R; i += x){
long long mn, mx;
MinMax(i, min(i + x - 1, R), &mn, &mx);
if(mn != -1){
ans = max(ans, mn - last);
last = mx;
}
}
return ans;
}