| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1323942 | aritro_ | Gap (APIO16_gap) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
#define int ll
#define pb push_back
//void MinMax(ll s,ll t,ll &mn,ll &mn);
ll findGap(ll t,ll n){
ll l=-1,r=1e18 + 1;
vector<int> a;
for(int i=0;i<=(n+1)/2;i++){
MinMax(l+1,r-1,&l,&r);
a.pb(l);
if(l!=r) a.pb(r);
}
sort(a.begin(),a.end());
int ans=0;
for(int i=0;i<n-1;i++) ans=max(ans,a[i+1]-a[i]);
return ans;
}