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"
using namespace std;
long long part1(int N)
{
long long mn = -1, mx = 1e18 + 2;
vector<long long> arr (N);
int i = 0, j = N-1;
while(i <= j)
{
long long a = mn+1, b = mx-1;
if(a > b)
break;
MinMax(a, b, &mn, &mx);
arr[i] = mn;
arr[j] = mx;
i++;
j--;
}
long long max_diff = 0;
for(int i = 0; i < N-1; i++)
max_diff = max(max_diff, arr[i+1] - arr[i]);
return max_diff;
}
long long part2(int N)
{
return 0;
}
long long findGap(int T, int N)
{
if(T == 1)
return part1(N);
else
return part2(N);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |