Submission #240351

#TimeUsernameProblemLanguageResultExecution timeMemory
240351ctziapoGap (APIO16_gap)C++14
30 / 100
89 ms1944 KiB
#include "gap.h" #include<algorithm> #include<cmath> using namespace std; long long findGap(int T, int N) { if(T==1){ long long int mi,ma; int n=N; MinMax(1,1000000000000000000,&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; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...