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;
using ll = long long;
ll findGap(int T, int N) {
ll ans = 0;
ll mn, mx;
MinMax(0, 1'000'000'000'000'000'000LL, &mn, &mx);
for (int i = 1; i < (N + 1) / 2; ++i) {
ll mn2, mx2;
MinMax(mn + 1, mx - 1, &mn2, &mx2);
ans = max({ans, mn2 - mn, mx - mx2});
mn = mn2;
mx = mx2;
}
ans = max(ans, mx - mn);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |