#include <bits/stdc++.h>
#define MAX 251000
typedef std::bitset<MAX> bits;
int main()
{
int N;
std::cin>>N;
int array[N];for(auto&x:array)std::cin>>x;
int t=0;
{
for(auto&x:array)t+=x;
if(t&1){
std::cout<<"0\n";
return 0;
}
bits x = {};
x[0]=1;
for(int i=0;i!=N;++i){
x|=x<<array[i];
}
if(!x[t/2]){
std::cout<<"0\n";
return 0;
}
}
bits permite={};
for(int i=0;i!=MAX;++i)permite[i]=1;
bool poc[2]={};
for(int i=0;i!=N;++i){
bits prod={};
prod[0]=1;
long long soma=0;
for(int j=0;j!=N;++j){
if(i==j)continue;
soma+=array[j];
prod|=prod<<array[j];
}
poc[soma&1]=1;
int meio = soma/2;
permite&=prod>>meio;
}
if(poc[0]==poc[1]){
std::cout<<"0\n";
return 0;
}
std::vector<int> pode;
for(int i=1;i!=MAX;++i){
if(permite[i])pode.push_back(i);
}
std::cout<<pode.size()<<"\n";
for(auto&x:pode){
std::cout<<((x*2)-(array[0]&1))<<" ";
}
std::cout<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
10 |
Correct |
8 ms |
412 KB |
Output is correct |
11 |
Correct |
8 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
6 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
408 KB |
Output is correct |
15 |
Correct |
8 ms |
332 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
5 ms |
332 KB |
Output is correct |
18 |
Correct |
7 ms |
332 KB |
Output is correct |
19 |
Correct |
7 ms |
408 KB |
Output is correct |
20 |
Correct |
9 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
10 |
Correct |
8 ms |
412 KB |
Output is correct |
11 |
Correct |
8 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
6 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
408 KB |
Output is correct |
15 |
Correct |
8 ms |
332 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
5 ms |
332 KB |
Output is correct |
18 |
Correct |
7 ms |
332 KB |
Output is correct |
19 |
Correct |
7 ms |
408 KB |
Output is correct |
20 |
Correct |
9 ms |
412 KB |
Output is correct |
21 |
Correct |
35 ms |
404 KB |
Output is correct |
22 |
Correct |
46 ms |
396 KB |
Output is correct |
23 |
Correct |
21 ms |
408 KB |
Output is correct |
24 |
Correct |
74 ms |
404 KB |
Output is correct |
25 |
Correct |
97 ms |
388 KB |
Output is correct |
26 |
Correct |
81 ms |
392 KB |
Output is correct |
27 |
Correct |
88 ms |
332 KB |
Output is correct |
28 |
Correct |
77 ms |
404 KB |
Output is correct |
29 |
Correct |
77 ms |
388 KB |
Output is correct |
30 |
Correct |
91 ms |
332 KB |
Output is correct |
31 |
Correct |
94 ms |
392 KB |
Output is correct |
32 |
Correct |
74 ms |
400 KB |
Output is correct |
33 |
Correct |
76 ms |
332 KB |
Output is correct |
34 |
Correct |
73 ms |
392 KB |
Output is correct |
35 |
Correct |
74 ms |
388 KB |
Output is correct |
36 |
Correct |
115 ms |
392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
10 |
Correct |
8 ms |
412 KB |
Output is correct |
11 |
Correct |
8 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
6 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
408 KB |
Output is correct |
15 |
Correct |
8 ms |
332 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
5 ms |
332 KB |
Output is correct |
18 |
Correct |
7 ms |
332 KB |
Output is correct |
19 |
Correct |
7 ms |
408 KB |
Output is correct |
20 |
Correct |
9 ms |
412 KB |
Output is correct |
21 |
Correct |
35 ms |
404 KB |
Output is correct |
22 |
Correct |
46 ms |
396 KB |
Output is correct |
23 |
Correct |
21 ms |
408 KB |
Output is correct |
24 |
Correct |
74 ms |
404 KB |
Output is correct |
25 |
Correct |
97 ms |
388 KB |
Output is correct |
26 |
Correct |
81 ms |
392 KB |
Output is correct |
27 |
Correct |
88 ms |
332 KB |
Output is correct |
28 |
Correct |
77 ms |
404 KB |
Output is correct |
29 |
Correct |
77 ms |
388 KB |
Output is correct |
30 |
Correct |
91 ms |
332 KB |
Output is correct |
31 |
Correct |
94 ms |
392 KB |
Output is correct |
32 |
Correct |
74 ms |
400 KB |
Output is correct |
33 |
Correct |
76 ms |
332 KB |
Output is correct |
34 |
Correct |
73 ms |
392 KB |
Output is correct |
35 |
Correct |
74 ms |
388 KB |
Output is correct |
36 |
Correct |
115 ms |
392 KB |
Output is correct |
37 |
Correct |
335 ms |
516 KB |
Output is correct |
38 |
Correct |
336 ms |
520 KB |
Output is correct |
39 |
Correct |
486 ms |
388 KB |
Output is correct |
40 |
Correct |
578 ms |
520 KB |
Output is correct |
41 |
Correct |
564 ms |
388 KB |
Output is correct |
42 |
Correct |
483 ms |
524 KB |
Output is correct |
43 |
Correct |
489 ms |
776 KB |
Output is correct |
44 |
Correct |
500 ms |
776 KB |
Output is correct |
45 |
Correct |
483 ms |
776 KB |
Output is correct |
46 |
Correct |
533 ms |
388 KB |
Output is correct |
47 |
Correct |
465 ms |
516 KB |
Output is correct |
48 |
Correct |
450 ms |
708 KB |
Output is correct |
49 |
Correct |
428 ms |
392 KB |
Output is correct |
50 |
Correct |
458 ms |
532 KB |
Output is correct |
51 |
Correct |
1 ms |
332 KB |
Output is correct |
52 |
Correct |
532 ms |
772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
10 |
Correct |
8 ms |
412 KB |
Output is correct |
11 |
Correct |
8 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
6 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
408 KB |
Output is correct |
15 |
Correct |
8 ms |
332 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
5 ms |
332 KB |
Output is correct |
18 |
Correct |
7 ms |
332 KB |
Output is correct |
19 |
Correct |
7 ms |
408 KB |
Output is correct |
20 |
Correct |
9 ms |
412 KB |
Output is correct |
21 |
Correct |
35 ms |
404 KB |
Output is correct |
22 |
Correct |
46 ms |
396 KB |
Output is correct |
23 |
Correct |
21 ms |
408 KB |
Output is correct |
24 |
Correct |
74 ms |
404 KB |
Output is correct |
25 |
Correct |
97 ms |
388 KB |
Output is correct |
26 |
Correct |
81 ms |
392 KB |
Output is correct |
27 |
Correct |
88 ms |
332 KB |
Output is correct |
28 |
Correct |
77 ms |
404 KB |
Output is correct |
29 |
Correct |
77 ms |
388 KB |
Output is correct |
30 |
Correct |
91 ms |
332 KB |
Output is correct |
31 |
Correct |
94 ms |
392 KB |
Output is correct |
32 |
Correct |
74 ms |
400 KB |
Output is correct |
33 |
Correct |
76 ms |
332 KB |
Output is correct |
34 |
Correct |
73 ms |
392 KB |
Output is correct |
35 |
Correct |
74 ms |
388 KB |
Output is correct |
36 |
Correct |
115 ms |
392 KB |
Output is correct |
37 |
Correct |
335 ms |
516 KB |
Output is correct |
38 |
Correct |
336 ms |
520 KB |
Output is correct |
39 |
Correct |
486 ms |
388 KB |
Output is correct |
40 |
Correct |
578 ms |
520 KB |
Output is correct |
41 |
Correct |
564 ms |
388 KB |
Output is correct |
42 |
Correct |
483 ms |
524 KB |
Output is correct |
43 |
Correct |
489 ms |
776 KB |
Output is correct |
44 |
Correct |
500 ms |
776 KB |
Output is correct |
45 |
Correct |
483 ms |
776 KB |
Output is correct |
46 |
Correct |
533 ms |
388 KB |
Output is correct |
47 |
Correct |
465 ms |
516 KB |
Output is correct |
48 |
Correct |
450 ms |
708 KB |
Output is correct |
49 |
Correct |
428 ms |
392 KB |
Output is correct |
50 |
Correct |
458 ms |
532 KB |
Output is correct |
51 |
Correct |
1 ms |
332 KB |
Output is correct |
52 |
Correct |
532 ms |
772 KB |
Output is correct |
53 |
Correct |
617 ms |
644 KB |
Output is correct |
54 |
Correct |
844 ms |
776 KB |
Output is correct |
55 |
Correct |
846 ms |
900 KB |
Output is correct |
56 |
Correct |
663 ms |
780 KB |
Output is correct |
57 |
Correct |
857 ms |
1088 KB |
Output is correct |
58 |
Correct |
871 ms |
772 KB |
Output is correct |
59 |
Correct |
866 ms |
832 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
896 ms |
900 KB |
Output is correct |
62 |
Correct |
714 ms |
960 KB |
Output is correct |
63 |
Correct |
710 ms |
1024 KB |
Output is correct |
64 |
Correct |
717 ms |
900 KB |
Output is correct |
65 |
Correct |
710 ms |
332 KB |
Output is correct |
66 |
Correct |
709 ms |
388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
3 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
412 KB |
Output is correct |
10 |
Correct |
8 ms |
412 KB |
Output is correct |
11 |
Correct |
8 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
6 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
408 KB |
Output is correct |
15 |
Correct |
8 ms |
332 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
5 ms |
332 KB |
Output is correct |
18 |
Correct |
7 ms |
332 KB |
Output is correct |
19 |
Correct |
7 ms |
408 KB |
Output is correct |
20 |
Correct |
9 ms |
412 KB |
Output is correct |
21 |
Correct |
35 ms |
404 KB |
Output is correct |
22 |
Correct |
46 ms |
396 KB |
Output is correct |
23 |
Correct |
21 ms |
408 KB |
Output is correct |
24 |
Correct |
74 ms |
404 KB |
Output is correct |
25 |
Correct |
97 ms |
388 KB |
Output is correct |
26 |
Correct |
81 ms |
392 KB |
Output is correct |
27 |
Correct |
88 ms |
332 KB |
Output is correct |
28 |
Correct |
77 ms |
404 KB |
Output is correct |
29 |
Correct |
77 ms |
388 KB |
Output is correct |
30 |
Correct |
91 ms |
332 KB |
Output is correct |
31 |
Correct |
94 ms |
392 KB |
Output is correct |
32 |
Correct |
74 ms |
400 KB |
Output is correct |
33 |
Correct |
76 ms |
332 KB |
Output is correct |
34 |
Correct |
73 ms |
392 KB |
Output is correct |
35 |
Correct |
74 ms |
388 KB |
Output is correct |
36 |
Correct |
115 ms |
392 KB |
Output is correct |
37 |
Correct |
335 ms |
516 KB |
Output is correct |
38 |
Correct |
336 ms |
520 KB |
Output is correct |
39 |
Correct |
486 ms |
388 KB |
Output is correct |
40 |
Correct |
578 ms |
520 KB |
Output is correct |
41 |
Correct |
564 ms |
388 KB |
Output is correct |
42 |
Correct |
483 ms |
524 KB |
Output is correct |
43 |
Correct |
489 ms |
776 KB |
Output is correct |
44 |
Correct |
500 ms |
776 KB |
Output is correct |
45 |
Correct |
483 ms |
776 KB |
Output is correct |
46 |
Correct |
533 ms |
388 KB |
Output is correct |
47 |
Correct |
465 ms |
516 KB |
Output is correct |
48 |
Correct |
450 ms |
708 KB |
Output is correct |
49 |
Correct |
428 ms |
392 KB |
Output is correct |
50 |
Correct |
458 ms |
532 KB |
Output is correct |
51 |
Correct |
1 ms |
332 KB |
Output is correct |
52 |
Correct |
532 ms |
772 KB |
Output is correct |
53 |
Correct |
617 ms |
644 KB |
Output is correct |
54 |
Correct |
844 ms |
776 KB |
Output is correct |
55 |
Correct |
846 ms |
900 KB |
Output is correct |
56 |
Correct |
663 ms |
780 KB |
Output is correct |
57 |
Correct |
857 ms |
1088 KB |
Output is correct |
58 |
Correct |
871 ms |
772 KB |
Output is correct |
59 |
Correct |
866 ms |
832 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
896 ms |
900 KB |
Output is correct |
62 |
Correct |
714 ms |
960 KB |
Output is correct |
63 |
Correct |
710 ms |
1024 KB |
Output is correct |
64 |
Correct |
717 ms |
900 KB |
Output is correct |
65 |
Correct |
710 ms |
332 KB |
Output is correct |
66 |
Correct |
709 ms |
388 KB |
Output is correct |
67 |
Execution timed out |
1085 ms |
332 KB |
Time limit exceeded |
68 |
Halted |
0 ms |
0 KB |
- |