제출 #915794

#제출 시각아이디문제언어결과실행 시간메모리
915794andrei_iorgulescuMean (info1cup19_mean)C++14
100 / 100
3 ms604 KiB
#include <bits/stdc++.h> using namespace std; int n,a[205]; int dp[205][205]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i],dp[i][i] = a[i]; for (int l = 2; l <= n; l++) { for (int i = 1; i <= n - l + 1; i++) { int j = i + l - 1; int mx = 0; for (int k = i; k < j; k++) mx = max(mx,(dp[i][k] + dp[k + 1][j]) / 2); dp[i][j] = mx; } } cout << dp[1][n]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...