Submission #1092491

#TimeUsernameProblemLanguageResultExecution timeMemory
1092491alexander707070Gap (APIO16_gap)C++14
70 / 100
43 ms7248 KiB
#include<bits/stdc++.h> #include "gap.h" #define MAXN 600007 using namespace std; const long long inf=1e18; long long *l,*r,*ll,*rr; long long d,ans; long long findGap(int T, int N){ l=new long long(); r=new long long(); MinMax(1, inf, l,r); if(N==2)return *r-*l; if(N<=4){ ll=new long long(); rr=new long long(); MinMax(*l+1,*r-1,ll,rr); return max(max(*ll-*l,*rr-*ll),*r-*rr); } d=ans=(long long) (*r-*l)/(N-1); while(*l!=*r){ while(true){ ll=new long long(); rr=new long long(); MinMax((*l)+1,(*l)+d+1,ll,rr); if((*ll)!=-1)break; d*=2; } ans=max(ans,*ll-*l); d=ans; l=rr; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...