# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
76388 | | vex | Gap (APIO16_gap) | C++14 | | 74 ms | 2264 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 <bits/stdc++.h>
#include<gap.h>
#define maxn 100005
#define INF 1e18 + 1000
using namespace std;
int n;
long long a[maxn];
long long findGap(int t,int n)
{
if(t==1)
{
int br=1;
long long mn,mx;
a[0]=0;
a[n+1]=INF;
while(br<=(n+1)/2)
{
MinMax(a[br-1]+1,a[n+2-br]-1,&mn,&mx);
a[br]=mn;
a[n+1-br]=mx;
br++;
}
long long sol=0;
for(int i=1;i<n;i++)
{
if(a[i+1]-a[i]>sol)sol=a[i+1]-a[i];
}
return sol;
}
long long mn,mx;
long long sol=0;
MinMax(1,INF,&mn,&mx);
long long last=mn;
long long exp=(mx-mn)/(n-1);
long long d=mn;
long long maxx=mx;
while(d<maxx)
{
MinMax(d+1,d+exp,&mn,&mx);
if(mn!=-1)
{
if(mn-last>sol && last!=0)sol=mn-last;
last=mx;
}
d+=exp;
if(sol>exp)exp=sol;
}
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |