# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166766 | 2019-12-04T02:41:00 Z | abil | Bootfall (IZhO17_bootfall) | C++14 | 490 ms | 2936 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("%lld", &n); for(int i = 1;i <= n; i++){ scanf("%lld", &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 <= sum; i++){ //cout << f[i] << " "; //} //cout << endl; 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++){ //cout << f[j] << " "; //} //cout << endl; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 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 | 5 ms | 376 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 6 ms | 376 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 | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 408 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 7 ms | 376 KB | Output is correct |
35 | Correct | 7 ms | 376 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 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 | 5 ms | 376 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 6 ms | 376 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 | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 408 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 7 ms | 376 KB | Output is correct |
35 | Correct | 7 ms | 376 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 18 ms | 504 KB | Output is correct |
38 | Correct | 18 ms | 576 KB | Output is correct |
39 | Correct | 75 ms | 888 KB | Output is correct |
40 | Correct | 37 ms | 764 KB | Output is correct |
41 | Correct | 96 ms | 888 KB | Output is correct |
42 | Correct | 32 ms | 632 KB | Output is correct |
43 | Correct | 58 ms | 888 KB | Output is correct |
44 | Correct | 58 ms | 888 KB | Output is correct |
45 | Correct | 59 ms | 888 KB | Output is correct |
46 | Correct | 41 ms | 632 KB | Output is correct |
47 | Correct | 34 ms | 632 KB | Output is correct |
48 | Correct | 67 ms | 1016 KB | Output is correct |
49 | Correct | 72 ms | 888 KB | Output is correct |
50 | Correct | 34 ms | 732 KB | Output is correct |
51 | Correct | 5 ms | 504 KB | Output is correct |
52 | Correct | 78 ms | 1016 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 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 | 5 ms | 376 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 6 ms | 376 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 | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 408 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 7 ms | 376 KB | Output is correct |
35 | Correct | 7 ms | 376 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 18 ms | 504 KB | Output is correct |
38 | Correct | 18 ms | 576 KB | Output is correct |
39 | Correct | 75 ms | 888 KB | Output is correct |
40 | Correct | 37 ms | 764 KB | Output is correct |
41 | Correct | 96 ms | 888 KB | Output is correct |
42 | Correct | 32 ms | 632 KB | Output is correct |
43 | Correct | 58 ms | 888 KB | Output is correct |
44 | Correct | 58 ms | 888 KB | Output is correct |
45 | Correct | 59 ms | 888 KB | Output is correct |
46 | Correct | 41 ms | 632 KB | Output is correct |
47 | Correct | 34 ms | 632 KB | Output is correct |
48 | Correct | 67 ms | 1016 KB | Output is correct |
49 | Correct | 72 ms | 888 KB | Output is correct |
50 | Correct | 34 ms | 732 KB | Output is correct |
51 | Correct | 5 ms | 504 KB | Output is correct |
52 | Correct | 78 ms | 1016 KB | Output is correct |
53 | Correct | 56 ms | 760 KB | Output is correct |
54 | Correct | 78 ms | 960 KB | Output is correct |
55 | Correct | 156 ms | 1528 KB | Output is correct |
56 | Correct | 68 ms | 888 KB | Output is correct |
57 | Correct | 165 ms | 1656 KB | Output is correct |
58 | Correct | 85 ms | 1016 KB | Output is correct |
59 | Correct | 107 ms | 1244 KB | Output is correct |
60 | Correct | 11 ms | 760 KB | Output is correct |
61 | Correct | 118 ms | 1272 KB | Output is correct |
62 | Correct | 121 ms | 1400 KB | Output is correct |
63 | Correct | 133 ms | 1460 KB | Output is correct |
64 | Correct | 129 ms | 1488 KB | Output is correct |
65 | Correct | 77 ms | 760 KB | Output is correct |
66 | Correct | 80 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 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 | 5 ms | 376 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 6 ms | 376 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 | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 408 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 7 ms | 376 KB | Output is correct |
34 | Correct | 7 ms | 376 KB | Output is correct |
35 | Correct | 7 ms | 376 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 18 ms | 504 KB | Output is correct |
38 | Correct | 18 ms | 576 KB | Output is correct |
39 | Correct | 75 ms | 888 KB | Output is correct |
40 | Correct | 37 ms | 764 KB | Output is correct |
41 | Correct | 96 ms | 888 KB | Output is correct |
42 | Correct | 32 ms | 632 KB | Output is correct |
43 | Correct | 58 ms | 888 KB | Output is correct |
44 | Correct | 58 ms | 888 KB | Output is correct |
45 | Correct | 59 ms | 888 KB | Output is correct |
46 | Correct | 41 ms | 632 KB | Output is correct |
47 | Correct | 34 ms | 632 KB | Output is correct |
48 | Correct | 67 ms | 1016 KB | Output is correct |
49 | Correct | 72 ms | 888 KB | Output is correct |
50 | Correct | 34 ms | 732 KB | Output is correct |
51 | Correct | 5 ms | 504 KB | Output is correct |
52 | Correct | 78 ms | 1016 KB | Output is correct |
53 | Correct | 56 ms | 760 KB | Output is correct |
54 | Correct | 78 ms | 960 KB | Output is correct |
55 | Correct | 156 ms | 1528 KB | Output is correct |
56 | Correct | 68 ms | 888 KB | Output is correct |
57 | Correct | 165 ms | 1656 KB | Output is correct |
58 | Correct | 85 ms | 1016 KB | Output is correct |
59 | Correct | 107 ms | 1244 KB | Output is correct |
60 | Correct | 11 ms | 760 KB | Output is correct |
61 | Correct | 118 ms | 1272 KB | Output is correct |
62 | Correct | 121 ms | 1400 KB | Output is correct |
63 | Correct | 133 ms | 1460 KB | Output is correct |
64 | Correct | 129 ms | 1488 KB | Output is correct |
65 | Correct | 77 ms | 760 KB | Output is correct |
66 | Correct | 80 ms | 760 KB | Output is correct |
67 | Correct | 122 ms | 1148 KB | Output is correct |
68 | Correct | 27 ms | 1364 KB | Output is correct |
69 | Correct | 411 ms | 2808 KB | Output is correct |
70 | Correct | 247 ms | 1756 KB | Output is correct |
71 | Correct | 240 ms | 1748 KB | Output is correct |
72 | Correct | 235 ms | 1400 KB | Output is correct |
73 | Correct | 233 ms | 1400 KB | Output is correct |
74 | Correct | 432 ms | 2936 KB | Output is correct |
75 | Correct | 341 ms | 2296 KB | Output is correct |
76 | Correct | 490 ms | 2936 KB | Output is correct |
77 | Correct | 471 ms | 2936 KB | Output is correct |