#include <bits/stdc++.h>
using namespace std;
ifstream fin("mean.in");
ofstream fout("mean.out");
const int NMAX = 203, INF = 1e9;
int v[NMAX], dp[NMAX][NMAX];
int mymax(int a, int b)
{
return(a > b ? a : b);
}
int main()
{
fin >> v[0];
for(int i = 1; i <= v[0]; ++i)
fin >> v[i], dp[i][i] = v[i];
for(int sz = 2; sz <= v[0]; ++sz) {
for(int i = 1; i <= v[0] - sz + 1; ++i) {
int j = i + sz - 1;
dp[i][j] = -INF;
for(int k = i; k <= j - 1; ++k)
dp[i][j] = mymax(dp[i][j], (dp[i][k] + dp[k + 1][j]) >> 1);
}
}
fout << dp[1][v[0]] << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |