# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342558 | 2021-01-02T11:19:21 Z | katearima | Bootfall (IZhO17_bootfall) | C++14 | 460 ms | 3556 KB |
#include <bits/stdc++.h> using namespace std; const int N=505; int n, a[N], sums[N*N+1], mx, num[N*N]; vector<int> ans; void Add(int x){ mx+=x; for(int j=mx; j>=x; j--){ sums[j]+=sums[j-x]; } } void Delete(int x){ for(int j=x; j<=mx; j++){ sums[j]-=sums[j-x]; } mx-=x; } main(){ cin>>n; sums[0]=1; for(int i=0; i<n; i++){ cin>>a[i]; Add(a[i]); } if(sums[mx/2]==0){ cout<<"0"<<endl; return 0; } for(int i=0; i<n; i++){ vector<bool> v(mx, false); Delete(a[i]); for(int j=0; j<=mx; j++){ if(sums[j]==0) continue; int k=abs(mx-2*j); if(!v[k]){ num[k]++; v[k]=true; } } Add(a[i]); } for(int i=0; i<=mx; i++){ if(num[i]==n) ans.push_back(i); } cout<<ans.size()<<endl; for(int i=0; i<ans.size(); i++){ cout<<ans[i]<<" "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 2 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 4 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 492 KB | Output is correct |
27 | Correct | 5 ms | 364 KB | Output is correct |
28 | Correct | 3 ms | 364 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 3 ms | 364 KB | Output is correct |
31 | Correct | 4 ms | 492 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 364 KB | Output is correct |
34 | Correct | 3 ms | 364 KB | Output is correct |
35 | Correct | 3 ms | 364 KB | Output is correct |
36 | Correct | 3 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 2 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 4 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 492 KB | Output is correct |
27 | Correct | 5 ms | 364 KB | Output is correct |
28 | Correct | 3 ms | 364 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 3 ms | 364 KB | Output is correct |
31 | Correct | 4 ms | 492 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 364 KB | Output is correct |
34 | Correct | 3 ms | 364 KB | Output is correct |
35 | Correct | 3 ms | 364 KB | Output is correct |
36 | Correct | 3 ms | 364 KB | Output is correct |
37 | Correct | 16 ms | 620 KB | Output is correct |
38 | Correct | 17 ms | 620 KB | Output is correct |
39 | Correct | 36 ms | 876 KB | Output is correct |
40 | Correct | 36 ms | 876 KB | Output is correct |
41 | Correct | 46 ms | 876 KB | Output is correct |
42 | Correct | 31 ms | 748 KB | Output is correct |
43 | Correct | 60 ms | 1260 KB | Output is correct |
44 | Correct | 56 ms | 1132 KB | Output is correct |
45 | Correct | 56 ms | 1132 KB | Output is correct |
46 | Correct | 25 ms | 620 KB | Output is correct |
47 | Correct | 36 ms | 748 KB | Output is correct |
48 | Correct | 55 ms | 1132 KB | Output is correct |
49 | Correct | 48 ms | 876 KB | Output is correct |
50 | Correct | 34 ms | 748 KB | Output is correct |
51 | Correct | 31 ms | 620 KB | Output is correct |
52 | Correct | 74 ms | 1324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 2 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 4 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 492 KB | Output is correct |
27 | Correct | 5 ms | 364 KB | Output is correct |
28 | Correct | 3 ms | 364 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 3 ms | 364 KB | Output is correct |
31 | Correct | 4 ms | 492 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 364 KB | Output is correct |
34 | Correct | 3 ms | 364 KB | Output is correct |
35 | Correct | 3 ms | 364 KB | Output is correct |
36 | Correct | 3 ms | 364 KB | Output is correct |
37 | Correct | 16 ms | 620 KB | Output is correct |
38 | Correct | 17 ms | 620 KB | Output is correct |
39 | Correct | 36 ms | 876 KB | Output is correct |
40 | Correct | 36 ms | 876 KB | Output is correct |
41 | Correct | 46 ms | 876 KB | Output is correct |
42 | Correct | 31 ms | 748 KB | Output is correct |
43 | Correct | 60 ms | 1260 KB | Output is correct |
44 | Correct | 56 ms | 1132 KB | Output is correct |
45 | Correct | 56 ms | 1132 KB | Output is correct |
46 | Correct | 25 ms | 620 KB | Output is correct |
47 | Correct | 36 ms | 748 KB | Output is correct |
48 | Correct | 55 ms | 1132 KB | Output is correct |
49 | Correct | 48 ms | 876 KB | Output is correct |
50 | Correct | 34 ms | 748 KB | Output is correct |
51 | Correct | 31 ms | 620 KB | Output is correct |
52 | Correct | 74 ms | 1324 KB | Output is correct |
53 | Correct | 57 ms | 1004 KB | Output is correct |
54 | Correct | 81 ms | 1132 KB | Output is correct |
55 | Correct | 149 ms | 1768 KB | Output is correct |
56 | Correct | 68 ms | 1132 KB | Output is correct |
57 | Correct | 167 ms | 1896 KB | Output is correct |
58 | Correct | 86 ms | 1260 KB | Output is correct |
59 | Correct | 106 ms | 1384 KB | Output is correct |
60 | Correct | 82 ms | 876 KB | Output is correct |
61 | Correct | 118 ms | 1640 KB | Output is correct |
62 | Correct | 121 ms | 1768 KB | Output is correct |
63 | Correct | 128 ms | 1768 KB | Output is correct |
64 | Correct | 125 ms | 1768 KB | Output is correct |
65 | Correct | 44 ms | 748 KB | Output is correct |
66 | Correct | 45 ms | 876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 2 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 4 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 492 KB | Output is correct |
27 | Correct | 5 ms | 364 KB | Output is correct |
28 | Correct | 3 ms | 364 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 3 ms | 364 KB | Output is correct |
31 | Correct | 4 ms | 492 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 364 KB | Output is correct |
34 | Correct | 3 ms | 364 KB | Output is correct |
35 | Correct | 3 ms | 364 KB | Output is correct |
36 | Correct | 3 ms | 364 KB | Output is correct |
37 | Correct | 16 ms | 620 KB | Output is correct |
38 | Correct | 17 ms | 620 KB | Output is correct |
39 | Correct | 36 ms | 876 KB | Output is correct |
40 | Correct | 36 ms | 876 KB | Output is correct |
41 | Correct | 46 ms | 876 KB | Output is correct |
42 | Correct | 31 ms | 748 KB | Output is correct |
43 | Correct | 60 ms | 1260 KB | Output is correct |
44 | Correct | 56 ms | 1132 KB | Output is correct |
45 | Correct | 56 ms | 1132 KB | Output is correct |
46 | Correct | 25 ms | 620 KB | Output is correct |
47 | Correct | 36 ms | 748 KB | Output is correct |
48 | Correct | 55 ms | 1132 KB | Output is correct |
49 | Correct | 48 ms | 876 KB | Output is correct |
50 | Correct | 34 ms | 748 KB | Output is correct |
51 | Correct | 31 ms | 620 KB | Output is correct |
52 | Correct | 74 ms | 1324 KB | Output is correct |
53 | Correct | 57 ms | 1004 KB | Output is correct |
54 | Correct | 81 ms | 1132 KB | Output is correct |
55 | Correct | 149 ms | 1768 KB | Output is correct |
56 | Correct | 68 ms | 1132 KB | Output is correct |
57 | Correct | 167 ms | 1896 KB | Output is correct |
58 | Correct | 86 ms | 1260 KB | Output is correct |
59 | Correct | 106 ms | 1384 KB | Output is correct |
60 | Correct | 82 ms | 876 KB | Output is correct |
61 | Correct | 118 ms | 1640 KB | Output is correct |
62 | Correct | 121 ms | 1768 KB | Output is correct |
63 | Correct | 128 ms | 1768 KB | Output is correct |
64 | Correct | 125 ms | 1768 KB | Output is correct |
65 | Correct | 44 ms | 748 KB | Output is correct |
66 | Correct | 45 ms | 876 KB | Output is correct |
67 | Correct | 124 ms | 1528 KB | Output is correct |
68 | Correct | 17 ms | 876 KB | Output is correct |
69 | Correct | 410 ms | 3208 KB | Output is correct |
70 | Correct | 254 ms | 2152 KB | Output is correct |
71 | Correct | 246 ms | 2136 KB | Output is correct |
72 | Correct | 247 ms | 1388 KB | Output is correct |
73 | Correct | 235 ms | 1388 KB | Output is correct |
74 | Correct | 436 ms | 3428 KB | Output is correct |
75 | Correct | 346 ms | 2816 KB | Output is correct |
76 | Correct | 460 ms | 3556 KB | Output is correct |
77 | Correct | 454 ms | 3428 KB | Output is correct |