Submission #1113981

#TimeUsernameProblemLanguageResultExecution timeMemory
1113981simona1230Gap (APIO16_gap)C++17
0 / 100
3081 ms1164 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long n; vector<long long> v; long long findGap(int t,int N) { n=N; long long l=0,r=0; MinMax(0,1e18,&l,&r); long long x=(l-n)/(n-1); long long last=-1; long long ans=0; for(int i=l;i<=r;i+=x) { long long j=min(i+x,r); long long mn,mx; MinMax(i,j,&mn,&mx); if(last!=-1)ans=max(mn-last,ans); last=mx; } return ans; } /*int main() { long long d=0; int x; cin>>x>>nn; for(int i=1;i<=nn;i++) { cin>>a[i]; if(i!=1)d=max(d,a[i]-a[i-1]); } long long answer=findGap(1,nn); cout<<d<<" "<<answer<<endl; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...