제출 #231663

#제출 시각아이디문제언어결과실행 시간메모리
231663filiptudose7Mean (info1cup19_mean)C++11
100 / 100
7 ms512 KiB
#include <bits/stdc++.h> using namespace std; int n,i,j,k,dp[205][205]; int main() { //freopen("in","r",stdin); //freopen("out","w",stdout); cin.sync_with_stdio(false); cin.tie(0); cin>>n; for(i=1;i<=n;++i) { int x; cin>>x; dp[i][i]=x; } for(i=n-1;i>=1;--i) { for(j=i+1;j<=n;++j) { for(k=i;k<j;++k) { dp[i][j]=max(dp[i][j],(dp[i][k]+dp[k+1][j])/2); } } } cout<<dp[1][n]<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...