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 ll = long long;
long long findGap(int T, int N)
{
ll min = 0;
ll max = 1000000000000000000;
std::vector<ll> numbers(N);
for (int i = 0; 2 * i < N; i++)
{
ll nextMin, nextMax;
MinMax(min, max, &nextMin, &nextMax);
numbers[i] = nextMin;
numbers[numbers.size() - i - 1] = nextMax;
min = nextMin + 1;
max = nextMax - 1;
}
ll maxDiff = 0;
for (int i = 1; i < N; i++)
{
maxDiff = std::max(maxDiff, numbers[i] - numbers[i - 1]);
}
return maxDiff;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |