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 <iostream>
#include <algorithm>
using namespace std;
long long findGap (int t, int n) {
if (t == 1) {
long long mn, mx;
long long p_mn = 0, p_mx = 1e18;
long long ans = 1e18;
for (int i=0; i<(n+1)/2; i++) {
MinMax(p_mn+1, p_mx-1, &mn, &mx);
if (mn > -1) ans = min(ans, mn-p_mn);
if (mx > -1) ans = min(ans, p_mx-mx);
p_mn = mn;
p_mx = mx;
}
return ans;
} else {
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |