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;
#define pb push_back
using ll = long long;
ll findGap(int T, int N) {
ll x, y;
MinMax(0, (ll)1e18, &x, &y);
ll k = (y - x + N - 2) / (N - 1), ans = 0;
vector<ll> seq;
seq.pb(x);
for (ll p = x; p < y; p += k) {
ll x2, y2;
MinMax(p + 1, p + k, &x2, &y2);
if (x2 != -1) {
seq.pb(x2);
seq.pb(y2);
}
}
seq.pb(y);
for (int i = 1; i < (int)seq.size(); i++) {
ans = max(ans, seq[i] - seq[i - 1]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |