#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];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |