Submission #526405

#TimeUsernameProblemLanguageResultExecution timeMemory
526405MihaiPopaMean (info1cup19_mean)C++14
0 / 100
0 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]; long long mymax(long long a, long long 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] = 0; for(int k = i; k <= j - 1; ++k) dp[i][j] = mymax(dp[i][j], (dp[i][k] + dp[k + 1][j]) >> 1LL); } } fout << dp[1][v[0]] << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...