# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242051 | michao | Gap (APIO16_gap) | C++14 | 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 <bits/stdc++.h>
#include "gap.h"
#define int long long
const int inf=1e18*2;
using namespace std;
vi answer,pom;
int n;
long long findGap(int t,int N)
{
n=N;
int ans=0;
int ip=-1,ik=inf;
if (t==1)
{
while (sz(answer)+sz(pom)<n)
{
ip++,ik--;
MinMax(ip,ik,&ip,&ik);
answer.pb(ip);
pom.pb(ik);
}
}
else
{
assert(false);
}
while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
return ans;
}