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 int64_t long long
long long findGap(int T, int N) {
if (T == 1) {
vector<int64_t> l, r;
int times = N + 1 >> 1;
int64_t ll = 0, rr = 1e18;
while (times--) {
int64_t a, b;
MinMax(ll, rr, &a, &b);
l.emplace_back(a);
r.emplace_back(b);
ll = a + 1, rr = b - 1;
assert(ll <= rr);
}
if (l.back() == r.back()) l.pop_back();
reverse(r.begin(), r.end());
l.insert(l.end(), r.begin(), r.end());
int64_t res = 0;
for (int i = 1; i < N; i++) res = max(res, l[i] - l[i - 1]);
return res;
}
return 0;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:31: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
10 | int times = N + 1 >> 1;
| ~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |