#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <queue>
#include <cstring>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
using namespace std;
#define pii pair<int, int>
#define f first
#define s second
#define ll long long
#define rint int32_t
const int siz = 250001;
rint main() {
cin.tie(0);
// ios_base::sync_with_stdio(0);
int n;
cin >> n;
int raw [n];
for (int i = 0; i < n; i++) cin >> raw[i];
bitset<siz> even(0);
bitset<siz> uneven(0);
for (int i = 1; i < siz; i++) even[i] = 1;
for (int i = 0; i < siz; i++) uneven[i] = 1;
bitset<siz> check(0);
check[0] = 1;
int checkSum = 0;
for (int i = 0; i < n; i++) {
check |= check<<raw[i];
checkSum += raw[i];
}
if (checkSum%2 == 1 or check[checkSum/2] == 0) {
even = bitset<siz>(0);
uneven = bitset<siz>(0);
}
for (int i = 0; i < n; i++) {
bitset<siz> cur(0);
cur[0] = 1;
int locSum = 0;
for (int j = 0; j < n; j++) if (i != j) {
cur |= cur<<raw[j];
locSum += raw[j];
}
if (locSum%2 == 0) {
even &= cur>>(locSum/2);
uneven &= 0;
}
else {
uneven &= cur>>(locSum/2+1);
even &= 0;
}
}
cout << even.count()+uneven.count() << endl;
for (int i = 0; i < siz; i++) {
if (even[i]) cout << i*2 << " ";
if (uneven[i]) cout << i*2+1 << " ";
}
int d = 0;
d++;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
10 |
Correct |
10 ms |
460 KB |
Output is correct |
11 |
Correct |
13 ms |
460 KB |
Output is correct |
12 |
Correct |
12 ms |
460 KB |
Output is correct |
13 |
Correct |
11 ms |
460 KB |
Output is correct |
14 |
Correct |
10 ms |
460 KB |
Output is correct |
15 |
Correct |
12 ms |
464 KB |
Output is correct |
16 |
Correct |
13 ms |
464 KB |
Output is correct |
17 |
Correct |
7 ms |
460 KB |
Output is correct |
18 |
Correct |
9 ms |
468 KB |
Output is correct |
19 |
Correct |
9 ms |
472 KB |
Output is correct |
20 |
Correct |
10 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
10 |
Correct |
10 ms |
460 KB |
Output is correct |
11 |
Correct |
13 ms |
460 KB |
Output is correct |
12 |
Correct |
12 ms |
460 KB |
Output is correct |
13 |
Correct |
11 ms |
460 KB |
Output is correct |
14 |
Correct |
10 ms |
460 KB |
Output is correct |
15 |
Correct |
12 ms |
464 KB |
Output is correct |
16 |
Correct |
13 ms |
464 KB |
Output is correct |
17 |
Correct |
7 ms |
460 KB |
Output is correct |
18 |
Correct |
9 ms |
468 KB |
Output is correct |
19 |
Correct |
9 ms |
472 KB |
Output is correct |
20 |
Correct |
10 ms |
468 KB |
Output is correct |
21 |
Correct |
37 ms |
460 KB |
Output is correct |
22 |
Correct |
49 ms |
460 KB |
Output is correct |
23 |
Correct |
24 ms |
460 KB |
Output is correct |
24 |
Correct |
100 ms |
460 KB |
Output is correct |
25 |
Correct |
78 ms |
460 KB |
Output is correct |
26 |
Correct |
86 ms |
460 KB |
Output is correct |
27 |
Correct |
86 ms |
460 KB |
Output is correct |
28 |
Correct |
95 ms |
464 KB |
Output is correct |
29 |
Correct |
87 ms |
444 KB |
Output is correct |
30 |
Correct |
103 ms |
460 KB |
Output is correct |
31 |
Correct |
86 ms |
460 KB |
Output is correct |
32 |
Correct |
91 ms |
460 KB |
Output is correct |
33 |
Correct |
88 ms |
460 KB |
Output is correct |
34 |
Correct |
92 ms |
460 KB |
Output is correct |
35 |
Correct |
99 ms |
460 KB |
Output is correct |
36 |
Correct |
91 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
10 |
Correct |
10 ms |
460 KB |
Output is correct |
11 |
Correct |
13 ms |
460 KB |
Output is correct |
12 |
Correct |
12 ms |
460 KB |
Output is correct |
13 |
Correct |
11 ms |
460 KB |
Output is correct |
14 |
Correct |
10 ms |
460 KB |
Output is correct |
15 |
Correct |
12 ms |
464 KB |
Output is correct |
16 |
Correct |
13 ms |
464 KB |
Output is correct |
17 |
Correct |
7 ms |
460 KB |
Output is correct |
18 |
Correct |
9 ms |
468 KB |
Output is correct |
19 |
Correct |
9 ms |
472 KB |
Output is correct |
20 |
Correct |
10 ms |
468 KB |
Output is correct |
21 |
Correct |
37 ms |
460 KB |
Output is correct |
22 |
Correct |
49 ms |
460 KB |
Output is correct |
23 |
Correct |
24 ms |
460 KB |
Output is correct |
24 |
Correct |
100 ms |
460 KB |
Output is correct |
25 |
Correct |
78 ms |
460 KB |
Output is correct |
26 |
Correct |
86 ms |
460 KB |
Output is correct |
27 |
Correct |
86 ms |
460 KB |
Output is correct |
28 |
Correct |
95 ms |
464 KB |
Output is correct |
29 |
Correct |
87 ms |
444 KB |
Output is correct |
30 |
Correct |
103 ms |
460 KB |
Output is correct |
31 |
Correct |
86 ms |
460 KB |
Output is correct |
32 |
Correct |
91 ms |
460 KB |
Output is correct |
33 |
Correct |
88 ms |
460 KB |
Output is correct |
34 |
Correct |
92 ms |
460 KB |
Output is correct |
35 |
Correct |
99 ms |
460 KB |
Output is correct |
36 |
Correct |
91 ms |
460 KB |
Output is correct |
37 |
Correct |
344 ms |
460 KB |
Output is correct |
38 |
Correct |
340 ms |
460 KB |
Output is correct |
39 |
Correct |
534 ms |
460 KB |
Output is correct |
40 |
Correct |
604 ms |
460 KB |
Output is correct |
41 |
Correct |
612 ms |
460 KB |
Output is correct |
42 |
Correct |
545 ms |
460 KB |
Output is correct |
43 |
Correct |
499 ms |
580 KB |
Output is correct |
44 |
Correct |
563 ms |
576 KB |
Output is correct |
45 |
Correct |
540 ms |
572 KB |
Output is correct |
46 |
Correct |
652 ms |
580 KB |
Output is correct |
47 |
Correct |
547 ms |
444 KB |
Output is correct |
48 |
Correct |
525 ms |
460 KB |
Output is correct |
49 |
Correct |
569 ms |
444 KB |
Output is correct |
50 |
Correct |
523 ms |
460 KB |
Output is correct |
51 |
Correct |
537 ms |
444 KB |
Output is correct |
52 |
Correct |
610 ms |
576 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
10 |
Correct |
10 ms |
460 KB |
Output is correct |
11 |
Correct |
13 ms |
460 KB |
Output is correct |
12 |
Correct |
12 ms |
460 KB |
Output is correct |
13 |
Correct |
11 ms |
460 KB |
Output is correct |
14 |
Correct |
10 ms |
460 KB |
Output is correct |
15 |
Correct |
12 ms |
464 KB |
Output is correct |
16 |
Correct |
13 ms |
464 KB |
Output is correct |
17 |
Correct |
7 ms |
460 KB |
Output is correct |
18 |
Correct |
9 ms |
468 KB |
Output is correct |
19 |
Correct |
9 ms |
472 KB |
Output is correct |
20 |
Correct |
10 ms |
468 KB |
Output is correct |
21 |
Correct |
37 ms |
460 KB |
Output is correct |
22 |
Correct |
49 ms |
460 KB |
Output is correct |
23 |
Correct |
24 ms |
460 KB |
Output is correct |
24 |
Correct |
100 ms |
460 KB |
Output is correct |
25 |
Correct |
78 ms |
460 KB |
Output is correct |
26 |
Correct |
86 ms |
460 KB |
Output is correct |
27 |
Correct |
86 ms |
460 KB |
Output is correct |
28 |
Correct |
95 ms |
464 KB |
Output is correct |
29 |
Correct |
87 ms |
444 KB |
Output is correct |
30 |
Correct |
103 ms |
460 KB |
Output is correct |
31 |
Correct |
86 ms |
460 KB |
Output is correct |
32 |
Correct |
91 ms |
460 KB |
Output is correct |
33 |
Correct |
88 ms |
460 KB |
Output is correct |
34 |
Correct |
92 ms |
460 KB |
Output is correct |
35 |
Correct |
99 ms |
460 KB |
Output is correct |
36 |
Correct |
91 ms |
460 KB |
Output is correct |
37 |
Correct |
344 ms |
460 KB |
Output is correct |
38 |
Correct |
340 ms |
460 KB |
Output is correct |
39 |
Correct |
534 ms |
460 KB |
Output is correct |
40 |
Correct |
604 ms |
460 KB |
Output is correct |
41 |
Correct |
612 ms |
460 KB |
Output is correct |
42 |
Correct |
545 ms |
460 KB |
Output is correct |
43 |
Correct |
499 ms |
580 KB |
Output is correct |
44 |
Correct |
563 ms |
576 KB |
Output is correct |
45 |
Correct |
540 ms |
572 KB |
Output is correct |
46 |
Correct |
652 ms |
580 KB |
Output is correct |
47 |
Correct |
547 ms |
444 KB |
Output is correct |
48 |
Correct |
525 ms |
460 KB |
Output is correct |
49 |
Correct |
569 ms |
444 KB |
Output is correct |
50 |
Correct |
523 ms |
460 KB |
Output is correct |
51 |
Correct |
537 ms |
444 KB |
Output is correct |
52 |
Correct |
610 ms |
576 KB |
Output is correct |
53 |
Correct |
759 ms |
576 KB |
Output is correct |
54 |
Execution timed out |
1040 ms |
580 KB |
Time limit exceeded |
55 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
460 KB |
Output is correct |
10 |
Correct |
10 ms |
460 KB |
Output is correct |
11 |
Correct |
13 ms |
460 KB |
Output is correct |
12 |
Correct |
12 ms |
460 KB |
Output is correct |
13 |
Correct |
11 ms |
460 KB |
Output is correct |
14 |
Correct |
10 ms |
460 KB |
Output is correct |
15 |
Correct |
12 ms |
464 KB |
Output is correct |
16 |
Correct |
13 ms |
464 KB |
Output is correct |
17 |
Correct |
7 ms |
460 KB |
Output is correct |
18 |
Correct |
9 ms |
468 KB |
Output is correct |
19 |
Correct |
9 ms |
472 KB |
Output is correct |
20 |
Correct |
10 ms |
468 KB |
Output is correct |
21 |
Correct |
37 ms |
460 KB |
Output is correct |
22 |
Correct |
49 ms |
460 KB |
Output is correct |
23 |
Correct |
24 ms |
460 KB |
Output is correct |
24 |
Correct |
100 ms |
460 KB |
Output is correct |
25 |
Correct |
78 ms |
460 KB |
Output is correct |
26 |
Correct |
86 ms |
460 KB |
Output is correct |
27 |
Correct |
86 ms |
460 KB |
Output is correct |
28 |
Correct |
95 ms |
464 KB |
Output is correct |
29 |
Correct |
87 ms |
444 KB |
Output is correct |
30 |
Correct |
103 ms |
460 KB |
Output is correct |
31 |
Correct |
86 ms |
460 KB |
Output is correct |
32 |
Correct |
91 ms |
460 KB |
Output is correct |
33 |
Correct |
88 ms |
460 KB |
Output is correct |
34 |
Correct |
92 ms |
460 KB |
Output is correct |
35 |
Correct |
99 ms |
460 KB |
Output is correct |
36 |
Correct |
91 ms |
460 KB |
Output is correct |
37 |
Correct |
344 ms |
460 KB |
Output is correct |
38 |
Correct |
340 ms |
460 KB |
Output is correct |
39 |
Correct |
534 ms |
460 KB |
Output is correct |
40 |
Correct |
604 ms |
460 KB |
Output is correct |
41 |
Correct |
612 ms |
460 KB |
Output is correct |
42 |
Correct |
545 ms |
460 KB |
Output is correct |
43 |
Correct |
499 ms |
580 KB |
Output is correct |
44 |
Correct |
563 ms |
576 KB |
Output is correct |
45 |
Correct |
540 ms |
572 KB |
Output is correct |
46 |
Correct |
652 ms |
580 KB |
Output is correct |
47 |
Correct |
547 ms |
444 KB |
Output is correct |
48 |
Correct |
525 ms |
460 KB |
Output is correct |
49 |
Correct |
569 ms |
444 KB |
Output is correct |
50 |
Correct |
523 ms |
460 KB |
Output is correct |
51 |
Correct |
537 ms |
444 KB |
Output is correct |
52 |
Correct |
610 ms |
576 KB |
Output is correct |
53 |
Correct |
759 ms |
576 KB |
Output is correct |
54 |
Execution timed out |
1040 ms |
580 KB |
Time limit exceeded |
55 |
Halted |
0 ms |
0 KB |
- |