# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709282 | groshi | Gap (APIO16_gap) | C++17 | 0 ms | 0 KiB |
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<iostream>
#include "gap.h"
using namespace std;
long long a[200000];
/*void MinMax(long long x,long long y,int *l,int *r)
{
cout<<x<<" "<<y<<"\n";
cin>>*l>>*r;
}*/
long long findGap(int t,int n)
{
if(t==1)
{
int l,r;
MinMax(0,(long long)1e18,&l,&r);
a[1]=l;
a[n]=r;
int pocz=2,kon=n-1;
while(pocz<=kon)
{
MinMax(a[pocz-1]+1,a[kon+1]-1,&l,&r);
a[pocz]=l;
a[kon]=r;
pocz++;
kon--;
}
long long wynik=0;
for(int i=1;i<n;i++)
wynik=max(wynik,a[i+1]-a[i]);
return wynik;
}
else{
}
}