| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 493277 | rainboy | Cigle (COI21_cigle) | C11 | 1091 ms | 67240 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 5000
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N + 1], dp[N + 1][N + 1];
int n, i, j, k, l, x, ans;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &aa[i]);
aa[i] += aa[i - 1];
}
for (i = 1; i <= n; i++)
dp[0][i] = 0;
for (i = 0; i <= n; i++)
for (j = i + 1; j <= n; j++)
for (k = j + 1, l = j - 1, x = dp[i][j]; k <= n; k++) {
dp[j][k] = max(dp[j][k], x);
while (l >= 0 && aa[k] + aa[l] > aa[j] * 2)
l--;
if (l > i && aa[k] + aa[l] == aa[j] * 2)
x++;
}
ans = 0;
for (i = 0; i < n; i++)
ans = max(ans, dp[i][n]);
printf("%d\n", ans);
return 0;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
