# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
931221 | hugsfromadicto | Mean (info1cup19_mean) | C++14 | 3 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.
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int M = 1e18;
const int mxN = 205;
int a[mxN];
int dp[202][202];
void _()
{
int n;
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++){
dp[i][j] = max(dp[i][j], (dp[i][k] + dp[k+1][j])/2);
}
}
}
cout << dp[1][n];
}
main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tc = 1;
//cin>>tc;
while(tc--)
{
_();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |