# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344170 | juggernaut | 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"
#ifdef EVAL
#else
#include"grader.cpp"
#endif
using namespace std;
typedef long long ll;
ll ans,mn,mx,n,l=-1,r=1e19+1;
vector<ll>x,y;
ll findGap(int t, int N){
n=N;
if(t==1){
while(x.size()+y.size()<n){
l++,r--;
MinMax(l,r,&l,&r);
x.push_back(l);
y.push_back(r);
}
}else{
MinMax(l,r,&l,&r);
x.push_back(l),y.push_back(r);
ll s=r-l+1LL;
s/=n;
s++;
for(ll i=l;i+1<r;i+=s){
ll nx=min(r-1,i+s);
MinMax(i+1,nx,&mn,&mx);
if(mn!=-1)x.push_back(mn);
if(mx!=-1)x.push_back(mx);
}