Submission #240342

#TimeUsernameProblemLanguageResultExecution timeMemory
240342ctziapoGap (APIO16_gap)C++14
0 / 100
47 ms1912 KiB
#include "gap.h" #include<algorithm> #include<cmath> using namespace std; long long findGap(int T, int N) { long long int mi,ma; int n=N; MinMax(1,1000000000000000,&mi,&ma); long long int a[n+3]; //cout<<mi<<" "<<ma<<endl; a[1]=mi; a[n]=ma; for(int i=2;i<=n/2;i++){ //cout<<1; mi++; ma--; //cout<<" 22 "<<mi<<" "<<ma; MinMax(mi,ma,&mi,&ma); // cout<<mi<<" "<<ma<<endl; a[i]=mi; a[n-i+1]=ma; } mi++; ma--; if(n%2==1){ MinMax(mi,ma,&mi,&ma); a[n/2+1]=mi; } long long int ans=0; for(int i=2;i<=n;i++){ ans=max(ans,a[i]-a[i-1]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...