Submission #441706

#TimeUsernameProblemLanguageResultExecution timeMemory
441706julian33Gap (APIO16_gap)C++14
0 / 100
543 ms524292 KiB
#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){ // if(mn>A.back()) // mn=-1; // else // mn=*lower_bound(A.begin(),A.end(),s); // if(mx<A[0]) // mx=-1; // else // mx=*--lower_bound(A.begin(),A.end(),t+1); } ll findGap(int t, int n){ assert(t==1); ll mn=0; ll mx=1e18; vector<ll> ans; while(mn<=mx){ ll premn=mn; ll premx=mx; MinMax(mn,mx,mn,mx); if(mn!=-1) ans.pb(mn); if(mx!=-1 && mx!=mn) ans.pb(mx); mx=~mx?mx-1:premx; mn=~mn?mn+1:premn; assert(mn>0 && mx>0); } sort(ans.begin(),ans.end()); ll best=0; for(int i=1;i<n;i++){ maxa(best,ans[i]-ans[i-1]); } return best; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...