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 "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
long long a[100005];
long long findGap(int T, int N)
{
long long ans = 0;
if(T==1)
{
long long l = -1,r = 4e18;
for(int i=1;i<=(N+1)/2;i++)
{
long long mn,mx;
MinMax(l+1,r-1,&mn,&mx);
a[i] = l = mn;
a[N-i+1] = r = mx;
}
}
else
{
long long lst = -1;
for(int i=1;i<=N;i++)
{
long long mn,mx;
MinMax(lst+1,lst+1,&mn,&mx);
// printf("%lld %lld %lld\n",lst+1,mn,mx);
a[i] = lst = mn;
}
}
for(int i=2;i<=N;i++) ans = max(ans,a[i]-a[i-1]);
return ans;
}
/*
1 3
0 1 100000000000000000
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |