제출 #1134711

#제출 시각아이디문제언어결과실행 시간메모리
1134711bpptidpMean (info1cup19_mean)C++20
100 / 100
2 ms584 KiB
#include <bits/stdc++.h> using namespace std; const int N=202; int a[N],dp[N][N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; for(int i=0;i<n;++i) cin>>a[i]; for(int i=0;i<n;++i) dp[i][i]=a[i]; for(int len=2;len<=n;++len){ for(int l=0;l+len<=n;++l){ int r=l+len-1; for(int m=l;m<r;++m) dp[l][r]=max(dp[l][r],(dp[l][m]+dp[m+1][r])/2); } } cout<<dp[0][n-1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...