# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869787 | rainboy | Mean (info1cup19_mean) | C11 | 2 ms | 512 KiB |
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 <stdio.h>
#define N 200
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N], dp[N][N];
int n, i, j, k;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
for (i = n - 1; i >= 0; i--)
for (j = i; j < n; j++)
if (i == j)
dp[i][j] = aa[i];
else
for (k = i; k < j; k++)
dp[i][j] = max(dp[i][j], (dp[i][k] + dp[k + 1][j]) / 2);
printf("%d\n", dp[0][n - 1]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |