# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919919 | divad | Mean (info1cup19_mean) | C++17 | 2 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 202;
int n,a[NMAX],dp[NMAX][NMAX];
void maxSelf(auto &a, auto b){
a = max(a, b);
}
int main()
{
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
dp[i][i] = a[i];
}
for(int len = 2; len <= n; len++){
for(int i = 1; i <= n-len+1; i++){
int j = i+len-1;
for(int k = i; k < j; k++){
maxSelf(dp[i][j], (dp[i][k] + dp[k+1][j])/2);
}
}
}
cout << dp[1][n];
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |