# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
166745 | 2019-12-03T15:22:02 Z | abil | Bootfall (IZhO17_bootfall) | C++14 | 553 ms | 2076 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() //#define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int INF = (0x3f3f3f3f); int a[N], f[N]; set<int > s; bitset< N > b; main() { int n, sum = 0; scanf("%d", &n); for(int i = 1;i <= n; i++){ scanf("%d", &a[i]); } f[0] = 1; for(int i = 1;i <= n; i++){ for(int j = sum + a[i];j >= a[i]; j--){ f[j] += f[j - a[i]]; if(f[j] >= mod){ f[j] -= mod; } } sum += a[i]; } if(!f[sum / 2] || sum & 1){ cout << 0; return 0; } for(int i = 1;i <= sum; i++){ b[i] = 1; } for(int i = 1;i <= n; i++){ for(int j = a[i];j <= sum; j++){ f[j] -= f[j - a[i]]; if(f[j] < 0){ f[j] += mod; } } for(int j = 1;j <= sum; j++){ if((sum - a[i] + j) & 1 || !f[(sum - a[i] + j) / 2]){ b[j] = 0; } } for(int j = sum;j >= a[i]; j--){ f[j] += f[j - a[i]]; if(f[j] >= mod){ f[j] -= mod; } } } cout << b.count() << endl; for(int i = 1;i <= sum; i++){ if(b[i]){ cout << i << " "; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 368 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 404 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 368 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 404 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 7 ms | 376 KB | Output is correct |
26 | Correct | 7 ms | 420 KB | Output is correct |
27 | Correct | 7 ms | 376 KB | Output is correct |
28 | Correct | 7 ms | 376 KB | Output is correct |
29 | Correct | 7 ms | 376 KB | Output is correct |
30 | Correct | 5 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 8 ms | 380 KB | Output is correct |
35 | Correct | 8 ms | 376 KB | Output is correct |
36 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 368 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 404 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 7 ms | 376 KB | Output is correct |
26 | Correct | 7 ms | 420 KB | Output is correct |
27 | Correct | 7 ms | 376 KB | Output is correct |
28 | Correct | 7 ms | 376 KB | Output is correct |
29 | Correct | 7 ms | 376 KB | Output is correct |
30 | Correct | 5 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 8 ms | 380 KB | Output is correct |
35 | Correct | 8 ms | 376 KB | Output is correct |
36 | Correct | 5 ms | 376 KB | Output is correct |
37 | Correct | 20 ms | 504 KB | Output is correct |
38 | Correct | 24 ms | 504 KB | Output is correct |
39 | Correct | 82 ms | 632 KB | Output is correct |
40 | Correct | 66 ms | 632 KB | Output is correct |
41 | Correct | 105 ms | 632 KB | Output is correct |
42 | Correct | 100 ms | 632 KB | Output is correct |
43 | Correct | 63 ms | 632 KB | Output is correct |
44 | Correct | 65 ms | 764 KB | Output is correct |
45 | Correct | 66 ms | 760 KB | Output is correct |
46 | Correct | 43 ms | 632 KB | Output is correct |
47 | Correct | 53 ms | 548 KB | Output is correct |
48 | Correct | 96 ms | 632 KB | Output is correct |
49 | Correct | 79 ms | 632 KB | Output is correct |
50 | Correct | 54 ms | 632 KB | Output is correct |
51 | Correct | 7 ms | 424 KB | Output is correct |
52 | Correct | 89 ms | 760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 368 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 404 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 7 ms | 376 KB | Output is correct |
26 | Correct | 7 ms | 420 KB | Output is correct |
27 | Correct | 7 ms | 376 KB | Output is correct |
28 | Correct | 7 ms | 376 KB | Output is correct |
29 | Correct | 7 ms | 376 KB | Output is correct |
30 | Correct | 5 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 8 ms | 380 KB | Output is correct |
35 | Correct | 8 ms | 376 KB | Output is correct |
36 | Correct | 5 ms | 376 KB | Output is correct |
37 | Correct | 20 ms | 504 KB | Output is correct |
38 | Correct | 24 ms | 504 KB | Output is correct |
39 | Correct | 82 ms | 632 KB | Output is correct |
40 | Correct | 66 ms | 632 KB | Output is correct |
41 | Correct | 105 ms | 632 KB | Output is correct |
42 | Correct | 100 ms | 632 KB | Output is correct |
43 | Correct | 63 ms | 632 KB | Output is correct |
44 | Correct | 65 ms | 764 KB | Output is correct |
45 | Correct | 66 ms | 760 KB | Output is correct |
46 | Correct | 43 ms | 632 KB | Output is correct |
47 | Correct | 53 ms | 548 KB | Output is correct |
48 | Correct | 96 ms | 632 KB | Output is correct |
49 | Correct | 79 ms | 632 KB | Output is correct |
50 | Correct | 54 ms | 632 KB | Output is correct |
51 | Correct | 7 ms | 424 KB | Output is correct |
52 | Correct | 89 ms | 760 KB | Output is correct |
53 | Correct | 68 ms | 596 KB | Output is correct |
54 | Correct | 89 ms | 736 KB | Output is correct |
55 | Correct | 194 ms | 1016 KB | Output is correct |
56 | Correct | 78 ms | 760 KB | Output is correct |
57 | Correct | 189 ms | 1116 KB | Output is correct |
58 | Correct | 97 ms | 764 KB | Output is correct |
59 | Correct | 125 ms | 964 KB | Output is correct |
60 | Correct | 14 ms | 632 KB | Output is correct |
61 | Correct | 137 ms | 1016 KB | Output is correct |
62 | Correct | 137 ms | 1016 KB | Output is correct |
63 | Correct | 152 ms | 1172 KB | Output is correct |
64 | Correct | 147 ms | 1144 KB | Output is correct |
65 | Correct | 83 ms | 608 KB | Output is correct |
66 | Correct | 86 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 368 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 404 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 7 ms | 376 KB | Output is correct |
26 | Correct | 7 ms | 420 KB | Output is correct |
27 | Correct | 7 ms | 376 KB | Output is correct |
28 | Correct | 7 ms | 376 KB | Output is correct |
29 | Correct | 7 ms | 376 KB | Output is correct |
30 | Correct | 5 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 376 KB | Output is correct |
32 | Correct | 5 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 8 ms | 380 KB | Output is correct |
35 | Correct | 8 ms | 376 KB | Output is correct |
36 | Correct | 5 ms | 376 KB | Output is correct |
37 | Correct | 20 ms | 504 KB | Output is correct |
38 | Correct | 24 ms | 504 KB | Output is correct |
39 | Correct | 82 ms | 632 KB | Output is correct |
40 | Correct | 66 ms | 632 KB | Output is correct |
41 | Correct | 105 ms | 632 KB | Output is correct |
42 | Correct | 100 ms | 632 KB | Output is correct |
43 | Correct | 63 ms | 632 KB | Output is correct |
44 | Correct | 65 ms | 764 KB | Output is correct |
45 | Correct | 66 ms | 760 KB | Output is correct |
46 | Correct | 43 ms | 632 KB | Output is correct |
47 | Correct | 53 ms | 548 KB | Output is correct |
48 | Correct | 96 ms | 632 KB | Output is correct |
49 | Correct | 79 ms | 632 KB | Output is correct |
50 | Correct | 54 ms | 632 KB | Output is correct |
51 | Correct | 7 ms | 424 KB | Output is correct |
52 | Correct | 89 ms | 760 KB | Output is correct |
53 | Correct | 68 ms | 596 KB | Output is correct |
54 | Correct | 89 ms | 736 KB | Output is correct |
55 | Correct | 194 ms | 1016 KB | Output is correct |
56 | Correct | 78 ms | 760 KB | Output is correct |
57 | Correct | 189 ms | 1116 KB | Output is correct |
58 | Correct | 97 ms | 764 KB | Output is correct |
59 | Correct | 125 ms | 964 KB | Output is correct |
60 | Correct | 14 ms | 632 KB | Output is correct |
61 | Correct | 137 ms | 1016 KB | Output is correct |
62 | Correct | 137 ms | 1016 KB | Output is correct |
63 | Correct | 152 ms | 1172 KB | Output is correct |
64 | Correct | 147 ms | 1144 KB | Output is correct |
65 | Correct | 83 ms | 608 KB | Output is correct |
66 | Correct | 86 ms | 632 KB | Output is correct |
67 | Correct | 139 ms | 832 KB | Output is correct |
68 | Correct | 40 ms | 760 KB | Output is correct |
69 | Correct | 468 ms | 2012 KB | Output is correct |
70 | Correct | 286 ms | 1400 KB | Output is correct |
71 | Correct | 276 ms | 1164 KB | Output is correct |
72 | Correct | 270 ms | 888 KB | Output is correct |
73 | Correct | 275 ms | 924 KB | Output is correct |
74 | Correct | 486 ms | 2040 KB | Output is correct |
75 | Correct | 387 ms | 1640 KB | Output is correct |
76 | Correct | 553 ms | 2076 KB | Output is correct |
77 | Correct | 529 ms | 2004 KB | Output is correct |