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 <vector>
#include <algorithm>
using namespace std;
long long findGap(int T, int N) {
if (T == 1) {
vector<long long> A(N);
long long L = 1, R = 1000000000000000000;
for (int i = 0; i < (N + 1) / 2; i++) {
long long MN, MX;
MinMax(L, R, &MN, &MX);
A[i] = MN, A[N - 1 - i] = MX;
L = MN + 1, R = MX - 1;
}
long long ANS = 1000000000000000000;
for (int i = 0; i < N - 1; i++) {
ANS = min(ANS, A[i + 1] - A[i]);
}
return ANS;
}
else {
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |