#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
//#define endl '\n'
llo n;
llo it[501];
llo vis[501*501];
bitset<501*501> ss;
llo su=0;
void solve(llo l,llo r){
if(l==r){
for(llo i=1;i<=500*500;i++){
llo x=(i+su-it[l]);
if(x%2==0){
if(ss[x/2]){
}
else{
vis[i]=1;
}
}
else{
vis[i]=1;
}
}
}
else{
bitset<501*501> tt=ss;
llo mid=(l+r)/2;
for(llo i=mid+1;i<=r;i++){
ss|=(ss<<it[i]);
}
solve(l,mid);
ss=tt;
for(llo i=l;i<=mid;i++){
ss|=(ss<<it[i]);
}
solve(mid+1,r);
ss=tt;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
bitset<501*501> kk;
kk[0]=1;
for(llo i=0;i<n;i++){
cin>>it[i];
su+=it[i];
kk|=(kk<<it[i]);
}
ss[0]=1;
solve(0,n-1);
vector<llo> cur;
for(llo i=1;i<=500*500;i++){
if(vis[i]==0){
cur.pb(i);
}
}
if(su%2==1){
cur.clear();
}
else{
if(kk[su/2]==0){
cur.clear();
}
}
cout<<cur.size()<<endl;
for(auto j:cur){
cout<<j<<" ";
}
cout<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
10 |
Correct |
14 ms |
2924 KB |
Output is correct |
11 |
Correct |
14 ms |
2924 KB |
Output is correct |
12 |
Correct |
17 ms |
2944 KB |
Output is correct |
13 |
Correct |
12 ms |
2924 KB |
Output is correct |
14 |
Correct |
16 ms |
3064 KB |
Output is correct |
15 |
Correct |
13 ms |
2924 KB |
Output is correct |
16 |
Correct |
14 ms |
2924 KB |
Output is correct |
17 |
Correct |
9 ms |
2924 KB |
Output is correct |
18 |
Correct |
12 ms |
2924 KB |
Output is correct |
19 |
Correct |
15 ms |
2924 KB |
Output is correct |
20 |
Correct |
14 ms |
2924 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
10 |
Correct |
14 ms |
2924 KB |
Output is correct |
11 |
Correct |
14 ms |
2924 KB |
Output is correct |
12 |
Correct |
17 ms |
2944 KB |
Output is correct |
13 |
Correct |
12 ms |
2924 KB |
Output is correct |
14 |
Correct |
16 ms |
3064 KB |
Output is correct |
15 |
Correct |
13 ms |
2924 KB |
Output is correct |
16 |
Correct |
14 ms |
2924 KB |
Output is correct |
17 |
Correct |
9 ms |
2924 KB |
Output is correct |
18 |
Correct |
12 ms |
2924 KB |
Output is correct |
19 |
Correct |
15 ms |
2924 KB |
Output is correct |
20 |
Correct |
14 ms |
2924 KB |
Output is correct |
21 |
Correct |
27 ms |
3044 KB |
Output is correct |
22 |
Correct |
31 ms |
3072 KB |
Output is correct |
23 |
Correct |
24 ms |
3044 KB |
Output is correct |
24 |
Correct |
39 ms |
3176 KB |
Output is correct |
25 |
Correct |
43 ms |
3172 KB |
Output is correct |
26 |
Correct |
42 ms |
3172 KB |
Output is correct |
27 |
Correct |
41 ms |
3052 KB |
Output is correct |
28 |
Correct |
41 ms |
3052 KB |
Output is correct |
29 |
Correct |
42 ms |
3052 KB |
Output is correct |
30 |
Correct |
43 ms |
3052 KB |
Output is correct |
31 |
Correct |
54 ms |
3172 KB |
Output is correct |
32 |
Correct |
42 ms |
3172 KB |
Output is correct |
33 |
Correct |
41 ms |
3052 KB |
Output is correct |
34 |
Correct |
41 ms |
3116 KB |
Output is correct |
35 |
Correct |
45 ms |
3052 KB |
Output is correct |
36 |
Correct |
43 ms |
3172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
10 |
Correct |
14 ms |
2924 KB |
Output is correct |
11 |
Correct |
14 ms |
2924 KB |
Output is correct |
12 |
Correct |
17 ms |
2944 KB |
Output is correct |
13 |
Correct |
12 ms |
2924 KB |
Output is correct |
14 |
Correct |
16 ms |
3064 KB |
Output is correct |
15 |
Correct |
13 ms |
2924 KB |
Output is correct |
16 |
Correct |
14 ms |
2924 KB |
Output is correct |
17 |
Correct |
9 ms |
2924 KB |
Output is correct |
18 |
Correct |
12 ms |
2924 KB |
Output is correct |
19 |
Correct |
15 ms |
2924 KB |
Output is correct |
20 |
Correct |
14 ms |
2924 KB |
Output is correct |
21 |
Correct |
27 ms |
3044 KB |
Output is correct |
22 |
Correct |
31 ms |
3072 KB |
Output is correct |
23 |
Correct |
24 ms |
3044 KB |
Output is correct |
24 |
Correct |
39 ms |
3176 KB |
Output is correct |
25 |
Correct |
43 ms |
3172 KB |
Output is correct |
26 |
Correct |
42 ms |
3172 KB |
Output is correct |
27 |
Correct |
41 ms |
3052 KB |
Output is correct |
28 |
Correct |
41 ms |
3052 KB |
Output is correct |
29 |
Correct |
42 ms |
3052 KB |
Output is correct |
30 |
Correct |
43 ms |
3052 KB |
Output is correct |
31 |
Correct |
54 ms |
3172 KB |
Output is correct |
32 |
Correct |
42 ms |
3172 KB |
Output is correct |
33 |
Correct |
41 ms |
3052 KB |
Output is correct |
34 |
Correct |
41 ms |
3116 KB |
Output is correct |
35 |
Correct |
45 ms |
3052 KB |
Output is correct |
36 |
Correct |
43 ms |
3172 KB |
Output is correct |
37 |
Correct |
85 ms |
3464 KB |
Output is correct |
38 |
Correct |
84 ms |
3428 KB |
Output is correct |
39 |
Correct |
108 ms |
3300 KB |
Output is correct |
40 |
Correct |
114 ms |
3556 KB |
Output is correct |
41 |
Correct |
110 ms |
3300 KB |
Output is correct |
42 |
Correct |
105 ms |
3428 KB |
Output is correct |
43 |
Correct |
106 ms |
3688 KB |
Output is correct |
44 |
Correct |
109 ms |
3688 KB |
Output is correct |
45 |
Correct |
107 ms |
3816 KB |
Output is correct |
46 |
Correct |
111 ms |
3180 KB |
Output is correct |
47 |
Correct |
108 ms |
3556 KB |
Output is correct |
48 |
Correct |
107 ms |
3600 KB |
Output is correct |
49 |
Correct |
109 ms |
3304 KB |
Output is correct |
50 |
Correct |
109 ms |
3556 KB |
Output is correct |
51 |
Correct |
107 ms |
3300 KB |
Output is correct |
52 |
Correct |
121 ms |
3944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
10 |
Correct |
14 ms |
2924 KB |
Output is correct |
11 |
Correct |
14 ms |
2924 KB |
Output is correct |
12 |
Correct |
17 ms |
2944 KB |
Output is correct |
13 |
Correct |
12 ms |
2924 KB |
Output is correct |
14 |
Correct |
16 ms |
3064 KB |
Output is correct |
15 |
Correct |
13 ms |
2924 KB |
Output is correct |
16 |
Correct |
14 ms |
2924 KB |
Output is correct |
17 |
Correct |
9 ms |
2924 KB |
Output is correct |
18 |
Correct |
12 ms |
2924 KB |
Output is correct |
19 |
Correct |
15 ms |
2924 KB |
Output is correct |
20 |
Correct |
14 ms |
2924 KB |
Output is correct |
21 |
Correct |
27 ms |
3044 KB |
Output is correct |
22 |
Correct |
31 ms |
3072 KB |
Output is correct |
23 |
Correct |
24 ms |
3044 KB |
Output is correct |
24 |
Correct |
39 ms |
3176 KB |
Output is correct |
25 |
Correct |
43 ms |
3172 KB |
Output is correct |
26 |
Correct |
42 ms |
3172 KB |
Output is correct |
27 |
Correct |
41 ms |
3052 KB |
Output is correct |
28 |
Correct |
41 ms |
3052 KB |
Output is correct |
29 |
Correct |
42 ms |
3052 KB |
Output is correct |
30 |
Correct |
43 ms |
3052 KB |
Output is correct |
31 |
Correct |
54 ms |
3172 KB |
Output is correct |
32 |
Correct |
42 ms |
3172 KB |
Output is correct |
33 |
Correct |
41 ms |
3052 KB |
Output is correct |
34 |
Correct |
41 ms |
3116 KB |
Output is correct |
35 |
Correct |
45 ms |
3052 KB |
Output is correct |
36 |
Correct |
43 ms |
3172 KB |
Output is correct |
37 |
Correct |
85 ms |
3464 KB |
Output is correct |
38 |
Correct |
84 ms |
3428 KB |
Output is correct |
39 |
Correct |
108 ms |
3300 KB |
Output is correct |
40 |
Correct |
114 ms |
3556 KB |
Output is correct |
41 |
Correct |
110 ms |
3300 KB |
Output is correct |
42 |
Correct |
105 ms |
3428 KB |
Output is correct |
43 |
Correct |
106 ms |
3688 KB |
Output is correct |
44 |
Correct |
109 ms |
3688 KB |
Output is correct |
45 |
Correct |
107 ms |
3816 KB |
Output is correct |
46 |
Correct |
111 ms |
3180 KB |
Output is correct |
47 |
Correct |
108 ms |
3556 KB |
Output is correct |
48 |
Correct |
107 ms |
3600 KB |
Output is correct |
49 |
Correct |
109 ms |
3304 KB |
Output is correct |
50 |
Correct |
109 ms |
3556 KB |
Output is correct |
51 |
Correct |
107 ms |
3300 KB |
Output is correct |
52 |
Correct |
121 ms |
3944 KB |
Output is correct |
53 |
Correct |
129 ms |
3816 KB |
Output is correct |
54 |
Correct |
151 ms |
3816 KB |
Output is correct |
55 |
Correct |
156 ms |
4068 KB |
Output is correct |
56 |
Correct |
134 ms |
3944 KB |
Output is correct |
57 |
Correct |
160 ms |
4324 KB |
Output is correct |
58 |
Correct |
152 ms |
3816 KB |
Output is correct |
59 |
Correct |
156 ms |
3944 KB |
Output is correct |
60 |
Correct |
147 ms |
3428 KB |
Output is correct |
61 |
Correct |
154 ms |
3944 KB |
Output is correct |
62 |
Correct |
142 ms |
4068 KB |
Output is correct |
63 |
Correct |
143 ms |
4064 KB |
Output is correct |
64 |
Correct |
140 ms |
4068 KB |
Output is correct |
65 |
Correct |
133 ms |
3308 KB |
Output is correct |
66 |
Correct |
129 ms |
3428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2540 KB |
Output is correct |
2 |
Correct |
5 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2540 KB |
Output is correct |
4 |
Correct |
4 ms |
2540 KB |
Output is correct |
5 |
Correct |
7 ms |
2796 KB |
Output is correct |
6 |
Correct |
5 ms |
2668 KB |
Output is correct |
7 |
Correct |
5 ms |
2668 KB |
Output is correct |
8 |
Correct |
9 ms |
2796 KB |
Output is correct |
9 |
Correct |
6 ms |
2796 KB |
Output is correct |
10 |
Correct |
14 ms |
2924 KB |
Output is correct |
11 |
Correct |
14 ms |
2924 KB |
Output is correct |
12 |
Correct |
17 ms |
2944 KB |
Output is correct |
13 |
Correct |
12 ms |
2924 KB |
Output is correct |
14 |
Correct |
16 ms |
3064 KB |
Output is correct |
15 |
Correct |
13 ms |
2924 KB |
Output is correct |
16 |
Correct |
14 ms |
2924 KB |
Output is correct |
17 |
Correct |
9 ms |
2924 KB |
Output is correct |
18 |
Correct |
12 ms |
2924 KB |
Output is correct |
19 |
Correct |
15 ms |
2924 KB |
Output is correct |
20 |
Correct |
14 ms |
2924 KB |
Output is correct |
21 |
Correct |
27 ms |
3044 KB |
Output is correct |
22 |
Correct |
31 ms |
3072 KB |
Output is correct |
23 |
Correct |
24 ms |
3044 KB |
Output is correct |
24 |
Correct |
39 ms |
3176 KB |
Output is correct |
25 |
Correct |
43 ms |
3172 KB |
Output is correct |
26 |
Correct |
42 ms |
3172 KB |
Output is correct |
27 |
Correct |
41 ms |
3052 KB |
Output is correct |
28 |
Correct |
41 ms |
3052 KB |
Output is correct |
29 |
Correct |
42 ms |
3052 KB |
Output is correct |
30 |
Correct |
43 ms |
3052 KB |
Output is correct |
31 |
Correct |
54 ms |
3172 KB |
Output is correct |
32 |
Correct |
42 ms |
3172 KB |
Output is correct |
33 |
Correct |
41 ms |
3052 KB |
Output is correct |
34 |
Correct |
41 ms |
3116 KB |
Output is correct |
35 |
Correct |
45 ms |
3052 KB |
Output is correct |
36 |
Correct |
43 ms |
3172 KB |
Output is correct |
37 |
Correct |
85 ms |
3464 KB |
Output is correct |
38 |
Correct |
84 ms |
3428 KB |
Output is correct |
39 |
Correct |
108 ms |
3300 KB |
Output is correct |
40 |
Correct |
114 ms |
3556 KB |
Output is correct |
41 |
Correct |
110 ms |
3300 KB |
Output is correct |
42 |
Correct |
105 ms |
3428 KB |
Output is correct |
43 |
Correct |
106 ms |
3688 KB |
Output is correct |
44 |
Correct |
109 ms |
3688 KB |
Output is correct |
45 |
Correct |
107 ms |
3816 KB |
Output is correct |
46 |
Correct |
111 ms |
3180 KB |
Output is correct |
47 |
Correct |
108 ms |
3556 KB |
Output is correct |
48 |
Correct |
107 ms |
3600 KB |
Output is correct |
49 |
Correct |
109 ms |
3304 KB |
Output is correct |
50 |
Correct |
109 ms |
3556 KB |
Output is correct |
51 |
Correct |
107 ms |
3300 KB |
Output is correct |
52 |
Correct |
121 ms |
3944 KB |
Output is correct |
53 |
Correct |
129 ms |
3816 KB |
Output is correct |
54 |
Correct |
151 ms |
3816 KB |
Output is correct |
55 |
Correct |
156 ms |
4068 KB |
Output is correct |
56 |
Correct |
134 ms |
3944 KB |
Output is correct |
57 |
Correct |
160 ms |
4324 KB |
Output is correct |
58 |
Correct |
152 ms |
3816 KB |
Output is correct |
59 |
Correct |
156 ms |
3944 KB |
Output is correct |
60 |
Correct |
147 ms |
3428 KB |
Output is correct |
61 |
Correct |
154 ms |
3944 KB |
Output is correct |
62 |
Correct |
142 ms |
4068 KB |
Output is correct |
63 |
Correct |
143 ms |
4064 KB |
Output is correct |
64 |
Correct |
140 ms |
4068 KB |
Output is correct |
65 |
Correct |
133 ms |
3308 KB |
Output is correct |
66 |
Correct |
129 ms |
3428 KB |
Output is correct |
67 |
Correct |
175 ms |
3944 KB |
Output is correct |
68 |
Correct |
217 ms |
3300 KB |
Output is correct |
69 |
Correct |
244 ms |
4832 KB |
Output is correct |
70 |
Correct |
228 ms |
4324 KB |
Output is correct |
71 |
Correct |
229 ms |
4324 KB |
Output is correct |
72 |
Correct |
221 ms |
3308 KB |
Output is correct |
73 |
Correct |
221 ms |
3300 KB |
Output is correct |
74 |
Correct |
248 ms |
4960 KB |
Output is correct |
75 |
Correct |
238 ms |
4576 KB |
Output is correct |
76 |
Correct |
251 ms |
4832 KB |
Output is correct |
77 |
Correct |
249 ms |
4960 KB |
Output is correct |