Submission #674404

#TimeUsernameProblemLanguageResultExecution timeMemory
674404QwertyPiMean (info1cup19_mean)C++14
100 / 100
3 ms468 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 200 + 11; int a[MAXN]; int dp[MAXN][MAXN]; int main(){ 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 d = 1; d < n; d++){ for(int i = 0; i < n - d; i++){ int l = i, r = i + d; 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] << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...