# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
441702 | julian33 | 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>
using namespace std;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define FOR(i,j,n) for(int i=j;i<n;i++)
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
vector<ll> A;
void MinMax(ll s,ll t,ll &mn, ll &mx){
// mn=*lower_bound(A.begin(),A.end(),s);
// mx=*--lower_bound(A.begin(),A.end(),t+1);
}
ll findGap(int t, ll n){
assert(t==1);
ll mn=0; ll mx=1e18;
vector<ll> ans;
for(int i=0;i<=n/2 && mn!=mx;i++){
MinMax(mn,mx,mn,mx);
ans.pb(mn); ans.pb(mx);
mn++; mx++;
}
while(sz(ans)<n)
ans.pb(mn);
sort(ans.begin(),ans.end());
ll best=0;
for(int i=1;i<n;i++){
maxa(best,ans[i]-ans[i-1]);
}
return best;
}