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 <bits/stdc++.h>
#include <gap.h>
long long findGap(int t, int n) {
long long left;
long long right;
left = 0;
right = 1e18;
long long mn, mx;
long long vec[n];
int cnt = 0;
int cn = n - 1;
while (mn != mx) {
MinMax(left, right, &mn, &mx);
vec[cnt++] = mn;
if (mn != mx)
vec[cn--] = mx;
left = mn + 1;
right= mx - 1;
}
long long ans = 0;
for (int i = 1; i < n; i++) {
if (vec[i] - vec[i - 1] > ans) {
ans = vec[i] - vec[i - 1];
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |