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;
using ll = long long;
#define int ll
int dp[205][205];
//dp[i][j] cel mai mare numar care se poate obtine dupa ce facem operatii pe numerele de la i la j
int v[205];
signed main()
{
int n;
cin >> n;
for(int i = 1; i <= n; i ++)
cin >> dp[i][i];
for(int i = 1; i <= n; i ++)
for(int j = i + 1; j <= n; j ++)
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];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |