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 "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int t, int n)
{
long long mx, mn;
MinMax(1, (long long)1e18, &mn, &mx);
long long ans = (mx - mn + n - 1) / n;
long long last = mn;
//go from s to t, but make jumps of size ans
long long curr = mn + 1;
while (curr <= mx){
//query [curr, curr + ans]
long long mi, ma;
MinMax(curr, curr + ans, &mi, &ma);
curr += ans;
if (mi == -1){
continue;
}
ans = max(mi - last, ans);
last = ma;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |