Submission #526403

#TimeUsernameProblemLanguageResultExecution timeMemory
526403MihaiPopaMean (info1cup19_mean)C++14
0 / 100
1 ms204 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...