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, l = 0, r = (ll)1e18, ans = 0;
vector<ll> lh, rh, all;
while (l <= r) {
MinMax(l, r, &x, &y);
if (x == -1) break;
lh.pb(x);
rh.pb(y);
l = x + 1;
r = y - 1;
}
reverse(rh.begin(), rh.end());
for (auto i : lh) all.pb(i);
for (auto i : rh) all.pb(i);
for (int i = 1; i < (int)all.size(); i++) {
ans = max(ans, all[i] - all[i - 1]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |