| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 793236 | rainboy | Kpart (eJOI21_kpart) | C11 | 717 ms | 588 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>
#include <string.h>
#define N 1000
#define S 50000
int max(int a, int b) { return a > b ? a : b; }
int main() {
int t;
scanf("%d", &t);
while (t--) {
static int aa[N], dp[S + 1];
static char good[N + 1];
int n, k, i, j, s, cnt;
scanf("%d", &n);
memset(dp, -1, (S + 1) * sizeof *dp);
memset(good, 1, (n + 1) * sizeof *good);
for (j = 0; j < n; j++) {
scanf("%d", &aa[j]);
for (s = S; s >= aa[j]; s--)
dp[s] = max(dp[s], dp[s - aa[j]]);
dp[aa[j]] = j;
s = 0;
for (i = j; i >= 0; i--) {
s += aa[i];
if (s % 2 != 0 || dp[s / 2] < i)
good[j - i + 1] = 0;
}
}
cnt = 0;
for (k = 1; k <= n; k++)
if (good[k])
cnt++;
printf("%d", cnt);
for (k = 1; k <= n; k++)
if (good[k])
printf(" %d", k);
printf("\n");
}
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... | ||||
