# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
133855 | 2019-07-21T14:34:33 Z | Kastanda | Bootfall (IZhO17_bootfall) | C++11 | 371 ms | 3064 KB |
// ItnoE #include<bits/stdc++.h> using namespace std; const int N = 505, MXN = N * N; int n, SM, A[N], B[MXN]; unsigned int dp[MXN]; inline void Add(int a) { for (int i = MXN - 1; i >= a; i --) dp[i] += dp[i - a]; } inline void Del(int a) { for (int i = a; i < MXN; i ++) dp[i] -= dp[i - a]; } int main() { scanf("%d", &n); dp[0] = 1; for (int i = 1; i <= n; i ++) scanf("%d", &A[i]), Add(A[i]), SM += A[i]; if (SM % 2 || !dp[SM / 2]) return !printf("0\n"); for (int i = 1; i <= n; i ++) { Del(A[i]); SM -= A[i]; for (int k = (SM + 1 & 1) + 1; k <= SM; k += 2) if (dp[(k + SM >> 1) - k]) B[k] ++; SM += A[i]; Add(A[i]); } int r = 0; for (int k = 1; k <= SM; k ++) if (B[k] == n) r ++; printf("%d\n", r); for (int k = 1; k <= SM; k ++) if (B[k] == n) printf("%d ", k); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
10 | Correct | 20 ms | 1400 KB | Output is correct |
11 | Correct | 23 ms | 1272 KB | Output is correct |
12 | Correct | 20 ms | 1400 KB | Output is correct |
13 | Correct | 18 ms | 1400 KB | Output is correct |
14 | Correct | 20 ms | 1272 KB | Output is correct |
15 | Correct | 21 ms | 1400 KB | Output is correct |
16 | Correct | 22 ms | 1272 KB | Output is correct |
17 | Correct | 14 ms | 1272 KB | Output is correct |
18 | Correct | 17 ms | 1400 KB | Output is correct |
19 | Correct | 18 ms | 1400 KB | Output is correct |
20 | Correct | 19 ms | 1400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
10 | Correct | 20 ms | 1400 KB | Output is correct |
11 | Correct | 23 ms | 1272 KB | Output is correct |
12 | Correct | 20 ms | 1400 KB | Output is correct |
13 | Correct | 18 ms | 1400 KB | Output is correct |
14 | Correct | 20 ms | 1272 KB | Output is correct |
15 | Correct | 21 ms | 1400 KB | Output is correct |
16 | Correct | 22 ms | 1272 KB | Output is correct |
17 | Correct | 14 ms | 1272 KB | Output is correct |
18 | Correct | 17 ms | 1400 KB | Output is correct |
19 | Correct | 18 ms | 1400 KB | Output is correct |
20 | Correct | 19 ms | 1400 KB | Output is correct |
21 | Correct | 39 ms | 1272 KB | Output is correct |
22 | Correct | 44 ms | 1400 KB | Output is correct |
23 | Correct | 32 ms | 1400 KB | Output is correct |
24 | Correct | 57 ms | 1400 KB | Output is correct |
25 | Correct | 56 ms | 1396 KB | Output is correct |
26 | Correct | 58 ms | 1500 KB | Output is correct |
27 | Correct | 58 ms | 1404 KB | Output is correct |
28 | Correct | 58 ms | 1400 KB | Output is correct |
29 | Correct | 58 ms | 1400 KB | Output is correct |
30 | Correct | 60 ms | 1404 KB | Output is correct |
31 | Correct | 58 ms | 1400 KB | Output is correct |
32 | Correct | 59 ms | 1400 KB | Output is correct |
33 | Correct | 58 ms | 1400 KB | Output is correct |
34 | Correct | 58 ms | 1400 KB | Output is correct |
35 | Correct | 58 ms | 1400 KB | Output is correct |
36 | Correct | 59 ms | 1400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
10 | Correct | 20 ms | 1400 KB | Output is correct |
11 | Correct | 23 ms | 1272 KB | Output is correct |
12 | Correct | 20 ms | 1400 KB | Output is correct |
13 | Correct | 18 ms | 1400 KB | Output is correct |
14 | Correct | 20 ms | 1272 KB | Output is correct |
15 | Correct | 21 ms | 1400 KB | Output is correct |
16 | Correct | 22 ms | 1272 KB | Output is correct |
17 | Correct | 14 ms | 1272 KB | Output is correct |
18 | Correct | 17 ms | 1400 KB | Output is correct |
19 | Correct | 18 ms | 1400 KB | Output is correct |
20 | Correct | 19 ms | 1400 KB | Output is correct |
21 | Correct | 39 ms | 1272 KB | Output is correct |
22 | Correct | 44 ms | 1400 KB | Output is correct |
23 | Correct | 32 ms | 1400 KB | Output is correct |
24 | Correct | 57 ms | 1400 KB | Output is correct |
25 | Correct | 56 ms | 1396 KB | Output is correct |
26 | Correct | 58 ms | 1500 KB | Output is correct |
27 | Correct | 58 ms | 1404 KB | Output is correct |
28 | Correct | 58 ms | 1400 KB | Output is correct |
29 | Correct | 58 ms | 1400 KB | Output is correct |
30 | Correct | 60 ms | 1404 KB | Output is correct |
31 | Correct | 58 ms | 1400 KB | Output is correct |
32 | Correct | 59 ms | 1400 KB | Output is correct |
33 | Correct | 58 ms | 1400 KB | Output is correct |
34 | Correct | 58 ms | 1400 KB | Output is correct |
35 | Correct | 58 ms | 1400 KB | Output is correct |
36 | Correct | 59 ms | 1400 KB | Output is correct |
37 | Correct | 115 ms | 1400 KB | Output is correct |
38 | Correct | 130 ms | 1528 KB | Output is correct |
39 | Correct | 145 ms | 1528 KB | Output is correct |
40 | Correct | 158 ms | 1520 KB | Output is correct |
41 | Correct | 160 ms | 1656 KB | Output is correct |
42 | Correct | 145 ms | 1532 KB | Output is correct |
43 | Correct | 147 ms | 1716 KB | Output is correct |
44 | Correct | 149 ms | 1720 KB | Output is correct |
45 | Correct | 151 ms | 1720 KB | Output is correct |
46 | Correct | 155 ms | 1500 KB | Output is correct |
47 | Correct | 147 ms | 1484 KB | Output is correct |
48 | Correct | 151 ms | 1656 KB | Output is correct |
49 | Correct | 155 ms | 1656 KB | Output is correct |
50 | Correct | 147 ms | 1528 KB | Output is correct |
51 | Correct | 43 ms | 1272 KB | Output is correct |
52 | Correct | 167 ms | 1800 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
10 | Correct | 20 ms | 1400 KB | Output is correct |
11 | Correct | 23 ms | 1272 KB | Output is correct |
12 | Correct | 20 ms | 1400 KB | Output is correct |
13 | Correct | 18 ms | 1400 KB | Output is correct |
14 | Correct | 20 ms | 1272 KB | Output is correct |
15 | Correct | 21 ms | 1400 KB | Output is correct |
16 | Correct | 22 ms | 1272 KB | Output is correct |
17 | Correct | 14 ms | 1272 KB | Output is correct |
18 | Correct | 17 ms | 1400 KB | Output is correct |
19 | Correct | 18 ms | 1400 KB | Output is correct |
20 | Correct | 19 ms | 1400 KB | Output is correct |
21 | Correct | 39 ms | 1272 KB | Output is correct |
22 | Correct | 44 ms | 1400 KB | Output is correct |
23 | Correct | 32 ms | 1400 KB | Output is correct |
24 | Correct | 57 ms | 1400 KB | Output is correct |
25 | Correct | 56 ms | 1396 KB | Output is correct |
26 | Correct | 58 ms | 1500 KB | Output is correct |
27 | Correct | 58 ms | 1404 KB | Output is correct |
28 | Correct | 58 ms | 1400 KB | Output is correct |
29 | Correct | 58 ms | 1400 KB | Output is correct |
30 | Correct | 60 ms | 1404 KB | Output is correct |
31 | Correct | 58 ms | 1400 KB | Output is correct |
32 | Correct | 59 ms | 1400 KB | Output is correct |
33 | Correct | 58 ms | 1400 KB | Output is correct |
34 | Correct | 58 ms | 1400 KB | Output is correct |
35 | Correct | 58 ms | 1400 KB | Output is correct |
36 | Correct | 59 ms | 1400 KB | Output is correct |
37 | Correct | 115 ms | 1400 KB | Output is correct |
38 | Correct | 130 ms | 1528 KB | Output is correct |
39 | Correct | 145 ms | 1528 KB | Output is correct |
40 | Correct | 158 ms | 1520 KB | Output is correct |
41 | Correct | 160 ms | 1656 KB | Output is correct |
42 | Correct | 145 ms | 1532 KB | Output is correct |
43 | Correct | 147 ms | 1716 KB | Output is correct |
44 | Correct | 149 ms | 1720 KB | Output is correct |
45 | Correct | 151 ms | 1720 KB | Output is correct |
46 | Correct | 155 ms | 1500 KB | Output is correct |
47 | Correct | 147 ms | 1484 KB | Output is correct |
48 | Correct | 151 ms | 1656 KB | Output is correct |
49 | Correct | 155 ms | 1656 KB | Output is correct |
50 | Correct | 147 ms | 1528 KB | Output is correct |
51 | Correct | 43 ms | 1272 KB | Output is correct |
52 | Correct | 167 ms | 1800 KB | Output is correct |
53 | Correct | 177 ms | 1784 KB | Output is correct |
54 | Correct | 208 ms | 1784 KB | Output is correct |
55 | Correct | 223 ms | 2172 KB | Output is correct |
56 | Correct | 184 ms | 1656 KB | Output is correct |
57 | Correct | 229 ms | 2040 KB | Output is correct |
58 | Correct | 211 ms | 1784 KB | Output is correct |
59 | Correct | 215 ms | 1912 KB | Output is correct |
60 | Correct | 59 ms | 1272 KB | Output is correct |
61 | Correct | 226 ms | 1884 KB | Output is correct |
62 | Correct | 203 ms | 1912 KB | Output is correct |
63 | Correct | 206 ms | 2064 KB | Output is correct |
64 | Correct | 200 ms | 2056 KB | Output is correct |
65 | Correct | 187 ms | 1528 KB | Output is correct |
66 | Correct | 236 ms | 1604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1400 KB | Output is correct |
2 | Correct | 6 ms | 1400 KB | Output is correct |
3 | Correct | 4 ms | 1400 KB | Output is correct |
4 | Correct | 5 ms | 1400 KB | Output is correct |
5 | Correct | 10 ms | 1400 KB | Output is correct |
6 | Correct | 7 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1400 KB | Output is correct |
8 | Correct | 10 ms | 1272 KB | Output is correct |
9 | Correct | 9 ms | 1400 KB | Output is correct |
10 | Correct | 20 ms | 1400 KB | Output is correct |
11 | Correct | 23 ms | 1272 KB | Output is correct |
12 | Correct | 20 ms | 1400 KB | Output is correct |
13 | Correct | 18 ms | 1400 KB | Output is correct |
14 | Correct | 20 ms | 1272 KB | Output is correct |
15 | Correct | 21 ms | 1400 KB | Output is correct |
16 | Correct | 22 ms | 1272 KB | Output is correct |
17 | Correct | 14 ms | 1272 KB | Output is correct |
18 | Correct | 17 ms | 1400 KB | Output is correct |
19 | Correct | 18 ms | 1400 KB | Output is correct |
20 | Correct | 19 ms | 1400 KB | Output is correct |
21 | Correct | 39 ms | 1272 KB | Output is correct |
22 | Correct | 44 ms | 1400 KB | Output is correct |
23 | Correct | 32 ms | 1400 KB | Output is correct |
24 | Correct | 57 ms | 1400 KB | Output is correct |
25 | Correct | 56 ms | 1396 KB | Output is correct |
26 | Correct | 58 ms | 1500 KB | Output is correct |
27 | Correct | 58 ms | 1404 KB | Output is correct |
28 | Correct | 58 ms | 1400 KB | Output is correct |
29 | Correct | 58 ms | 1400 KB | Output is correct |
30 | Correct | 60 ms | 1404 KB | Output is correct |
31 | Correct | 58 ms | 1400 KB | Output is correct |
32 | Correct | 59 ms | 1400 KB | Output is correct |
33 | Correct | 58 ms | 1400 KB | Output is correct |
34 | Correct | 58 ms | 1400 KB | Output is correct |
35 | Correct | 58 ms | 1400 KB | Output is correct |
36 | Correct | 59 ms | 1400 KB | Output is correct |
37 | Correct | 115 ms | 1400 KB | Output is correct |
38 | Correct | 130 ms | 1528 KB | Output is correct |
39 | Correct | 145 ms | 1528 KB | Output is correct |
40 | Correct | 158 ms | 1520 KB | Output is correct |
41 | Correct | 160 ms | 1656 KB | Output is correct |
42 | Correct | 145 ms | 1532 KB | Output is correct |
43 | Correct | 147 ms | 1716 KB | Output is correct |
44 | Correct | 149 ms | 1720 KB | Output is correct |
45 | Correct | 151 ms | 1720 KB | Output is correct |
46 | Correct | 155 ms | 1500 KB | Output is correct |
47 | Correct | 147 ms | 1484 KB | Output is correct |
48 | Correct | 151 ms | 1656 KB | Output is correct |
49 | Correct | 155 ms | 1656 KB | Output is correct |
50 | Correct | 147 ms | 1528 KB | Output is correct |
51 | Correct | 43 ms | 1272 KB | Output is correct |
52 | Correct | 167 ms | 1800 KB | Output is correct |
53 | Correct | 177 ms | 1784 KB | Output is correct |
54 | Correct | 208 ms | 1784 KB | Output is correct |
55 | Correct | 223 ms | 2172 KB | Output is correct |
56 | Correct | 184 ms | 1656 KB | Output is correct |
57 | Correct | 229 ms | 2040 KB | Output is correct |
58 | Correct | 211 ms | 1784 KB | Output is correct |
59 | Correct | 215 ms | 1912 KB | Output is correct |
60 | Correct | 59 ms | 1272 KB | Output is correct |
61 | Correct | 226 ms | 1884 KB | Output is correct |
62 | Correct | 203 ms | 1912 KB | Output is correct |
63 | Correct | 206 ms | 2064 KB | Output is correct |
64 | Correct | 200 ms | 2056 KB | Output is correct |
65 | Correct | 187 ms | 1528 KB | Output is correct |
66 | Correct | 236 ms | 1604 KB | Output is correct |
67 | Correct | 255 ms | 1832 KB | Output is correct |
68 | Correct | 83 ms | 1272 KB | Output is correct |
69 | Correct | 354 ms | 2900 KB | Output is correct |
70 | Correct | 326 ms | 2168 KB | Output is correct |
71 | Correct | 322 ms | 2296 KB | Output is correct |
72 | Correct | 319 ms | 1912 KB | Output is correct |
73 | Correct | 317 ms | 1888 KB | Output is correct |
74 | Correct | 359 ms | 2936 KB | Output is correct |
75 | Correct | 341 ms | 2552 KB | Output is correct |
76 | Correct | 371 ms | 3064 KB | Output is correct |
77 | Correct | 365 ms | 2968 KB | Output is correct |