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>
#define pb push_back
#define x first
#define y second
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
ll findGap(int T, int N) {
if(T == 1) {
return 0;
}
if(T == 2) {
ll lo = 0, hi = 1e18;
MinMax(lo, hi, &lo, &hi);
ll min_gap = (hi - lo) / ((ll)N - 1);
ll ans = 0;
ll x = lo, lst = 0, l, r;
while(x <= hi) {
MinMax(x, x + min_gap - 1, &l, &r);
if(l != -1)
ans = max(ans, l - lst);
x += min_gap;
if(r != -1) lst = r;
}
return ans;
}
}
Compilation message (stderr)
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
34 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |