#include <bits/stdc++.h>
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("-O3")
#pragma GCC optimize ("Ofast")
#define sz(x) ((int)x.size())
#define PB push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int N = 273;
const int N2 = N * N;
const int PW = 20;
const int oo = 2e9;
bitset<N2 * 2> f[2], cle, full;
vector<int> vc;
int n, a[N], ed;
void calc(){
ed = 0;
f[0] = cle;
f[0][N2] = 1;
for (int i = 0; i < sz(vc); i++){
ed ^= 1;
int cr = a[vc[i]];
f[ed] = (f[ed ^ 1] >> cr) | (f[ed ^ 1] << cr);
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
// freopen("in.txt","r",stdin);
vc.clear();
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
vc.PB(i);
}
calc();
if (f[ed][N2] == 0){
cout << 0;
return 0;
}
for (int i = 0; i < N2 + N2; i++)
full[i] = 1;
for (int i = 0; i < n; i++){
vc.clear();
for (int j = 0; j < n; j++)
if (j != i)
vc.PB(j);
calc();
full &= f[ed];
}
vc.clear();
for (int i = 1; i < N2; i++)
if (full[N2 + i])
vc.PB(i);
cout << sz(vc) << '\n';
for (int x : vc)
cout << x << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
10 |
Correct |
15 ms |
504 KB |
Output is correct |
11 |
Correct |
16 ms |
504 KB |
Output is correct |
12 |
Correct |
15 ms |
504 KB |
Output is correct |
13 |
Correct |
12 ms |
380 KB |
Output is correct |
14 |
Correct |
14 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
7 ms |
504 KB |
Output is correct |
18 |
Correct |
11 ms |
508 KB |
Output is correct |
19 |
Correct |
29 ms |
504 KB |
Output is correct |
20 |
Correct |
16 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
10 |
Correct |
15 ms |
504 KB |
Output is correct |
11 |
Correct |
16 ms |
504 KB |
Output is correct |
12 |
Correct |
15 ms |
504 KB |
Output is correct |
13 |
Correct |
12 ms |
380 KB |
Output is correct |
14 |
Correct |
14 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
7 ms |
504 KB |
Output is correct |
18 |
Correct |
11 ms |
508 KB |
Output is correct |
19 |
Correct |
29 ms |
504 KB |
Output is correct |
20 |
Correct |
16 ms |
504 KB |
Output is correct |
21 |
Correct |
61 ms |
636 KB |
Output is correct |
22 |
Correct |
78 ms |
504 KB |
Output is correct |
23 |
Correct |
39 ms |
504 KB |
Output is correct |
24 |
Correct |
124 ms |
504 KB |
Output is correct |
25 |
Correct |
123 ms |
504 KB |
Output is correct |
26 |
Correct |
139 ms |
504 KB |
Output is correct |
27 |
Correct |
135 ms |
504 KB |
Output is correct |
28 |
Correct |
139 ms |
508 KB |
Output is correct |
29 |
Correct |
137 ms |
512 KB |
Output is correct |
30 |
Correct |
138 ms |
632 KB |
Output is correct |
31 |
Correct |
140 ms |
540 KB |
Output is correct |
32 |
Correct |
139 ms |
508 KB |
Output is correct |
33 |
Correct |
139 ms |
504 KB |
Output is correct |
34 |
Correct |
138 ms |
504 KB |
Output is correct |
35 |
Correct |
139 ms |
516 KB |
Output is correct |
36 |
Correct |
143 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
10 |
Correct |
15 ms |
504 KB |
Output is correct |
11 |
Correct |
16 ms |
504 KB |
Output is correct |
12 |
Correct |
15 ms |
504 KB |
Output is correct |
13 |
Correct |
12 ms |
380 KB |
Output is correct |
14 |
Correct |
14 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
7 ms |
504 KB |
Output is correct |
18 |
Correct |
11 ms |
508 KB |
Output is correct |
19 |
Correct |
29 ms |
504 KB |
Output is correct |
20 |
Correct |
16 ms |
504 KB |
Output is correct |
21 |
Correct |
61 ms |
636 KB |
Output is correct |
22 |
Correct |
78 ms |
504 KB |
Output is correct |
23 |
Correct |
39 ms |
504 KB |
Output is correct |
24 |
Correct |
124 ms |
504 KB |
Output is correct |
25 |
Correct |
123 ms |
504 KB |
Output is correct |
26 |
Correct |
139 ms |
504 KB |
Output is correct |
27 |
Correct |
135 ms |
504 KB |
Output is correct |
28 |
Correct |
139 ms |
508 KB |
Output is correct |
29 |
Correct |
137 ms |
512 KB |
Output is correct |
30 |
Correct |
138 ms |
632 KB |
Output is correct |
31 |
Correct |
140 ms |
540 KB |
Output is correct |
32 |
Correct |
139 ms |
508 KB |
Output is correct |
33 |
Correct |
139 ms |
504 KB |
Output is correct |
34 |
Correct |
138 ms |
504 KB |
Output is correct |
35 |
Correct |
139 ms |
516 KB |
Output is correct |
36 |
Correct |
143 ms |
504 KB |
Output is correct |
37 |
Correct |
539 ms |
648 KB |
Output is correct |
38 |
Correct |
531 ms |
760 KB |
Output is correct |
39 |
Correct |
723 ms |
512 KB |
Output is correct |
40 |
Correct |
943 ms |
788 KB |
Output is correct |
41 |
Correct |
870 ms |
504 KB |
Output is correct |
42 |
Correct |
802 ms |
632 KB |
Output is correct |
43 |
Correct |
702 ms |
896 KB |
Output is correct |
44 |
Correct |
745 ms |
928 KB |
Output is correct |
45 |
Correct |
739 ms |
888 KB |
Output is correct |
46 |
Correct |
924 ms |
508 KB |
Output is correct |
47 |
Correct |
807 ms |
760 KB |
Output is correct |
48 |
Correct |
733 ms |
760 KB |
Output is correct |
49 |
Correct |
735 ms |
632 KB |
Output is correct |
50 |
Correct |
979 ms |
760 KB |
Output is correct |
51 |
Correct |
6 ms |
420 KB |
Output is correct |
52 |
Correct |
861 ms |
988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
10 |
Correct |
15 ms |
504 KB |
Output is correct |
11 |
Correct |
16 ms |
504 KB |
Output is correct |
12 |
Correct |
15 ms |
504 KB |
Output is correct |
13 |
Correct |
12 ms |
380 KB |
Output is correct |
14 |
Correct |
14 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
7 ms |
504 KB |
Output is correct |
18 |
Correct |
11 ms |
508 KB |
Output is correct |
19 |
Correct |
29 ms |
504 KB |
Output is correct |
20 |
Correct |
16 ms |
504 KB |
Output is correct |
21 |
Correct |
61 ms |
636 KB |
Output is correct |
22 |
Correct |
78 ms |
504 KB |
Output is correct |
23 |
Correct |
39 ms |
504 KB |
Output is correct |
24 |
Correct |
124 ms |
504 KB |
Output is correct |
25 |
Correct |
123 ms |
504 KB |
Output is correct |
26 |
Correct |
139 ms |
504 KB |
Output is correct |
27 |
Correct |
135 ms |
504 KB |
Output is correct |
28 |
Correct |
139 ms |
508 KB |
Output is correct |
29 |
Correct |
137 ms |
512 KB |
Output is correct |
30 |
Correct |
138 ms |
632 KB |
Output is correct |
31 |
Correct |
140 ms |
540 KB |
Output is correct |
32 |
Correct |
139 ms |
508 KB |
Output is correct |
33 |
Correct |
139 ms |
504 KB |
Output is correct |
34 |
Correct |
138 ms |
504 KB |
Output is correct |
35 |
Correct |
139 ms |
516 KB |
Output is correct |
36 |
Correct |
143 ms |
504 KB |
Output is correct |
37 |
Correct |
539 ms |
648 KB |
Output is correct |
38 |
Correct |
531 ms |
760 KB |
Output is correct |
39 |
Correct |
723 ms |
512 KB |
Output is correct |
40 |
Correct |
943 ms |
788 KB |
Output is correct |
41 |
Correct |
870 ms |
504 KB |
Output is correct |
42 |
Correct |
802 ms |
632 KB |
Output is correct |
43 |
Correct |
702 ms |
896 KB |
Output is correct |
44 |
Correct |
745 ms |
928 KB |
Output is correct |
45 |
Correct |
739 ms |
888 KB |
Output is correct |
46 |
Correct |
924 ms |
508 KB |
Output is correct |
47 |
Correct |
807 ms |
760 KB |
Output is correct |
48 |
Correct |
733 ms |
760 KB |
Output is correct |
49 |
Correct |
735 ms |
632 KB |
Output is correct |
50 |
Correct |
979 ms |
760 KB |
Output is correct |
51 |
Correct |
6 ms |
420 KB |
Output is correct |
52 |
Correct |
861 ms |
988 KB |
Output is correct |
53 |
Incorrect |
366 ms |
672 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
4 ms |
504 KB |
Output is correct |
9 |
Correct |
4 ms |
504 KB |
Output is correct |
10 |
Correct |
15 ms |
504 KB |
Output is correct |
11 |
Correct |
16 ms |
504 KB |
Output is correct |
12 |
Correct |
15 ms |
504 KB |
Output is correct |
13 |
Correct |
12 ms |
380 KB |
Output is correct |
14 |
Correct |
14 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
7 ms |
504 KB |
Output is correct |
18 |
Correct |
11 ms |
508 KB |
Output is correct |
19 |
Correct |
29 ms |
504 KB |
Output is correct |
20 |
Correct |
16 ms |
504 KB |
Output is correct |
21 |
Correct |
61 ms |
636 KB |
Output is correct |
22 |
Correct |
78 ms |
504 KB |
Output is correct |
23 |
Correct |
39 ms |
504 KB |
Output is correct |
24 |
Correct |
124 ms |
504 KB |
Output is correct |
25 |
Correct |
123 ms |
504 KB |
Output is correct |
26 |
Correct |
139 ms |
504 KB |
Output is correct |
27 |
Correct |
135 ms |
504 KB |
Output is correct |
28 |
Correct |
139 ms |
508 KB |
Output is correct |
29 |
Correct |
137 ms |
512 KB |
Output is correct |
30 |
Correct |
138 ms |
632 KB |
Output is correct |
31 |
Correct |
140 ms |
540 KB |
Output is correct |
32 |
Correct |
139 ms |
508 KB |
Output is correct |
33 |
Correct |
139 ms |
504 KB |
Output is correct |
34 |
Correct |
138 ms |
504 KB |
Output is correct |
35 |
Correct |
139 ms |
516 KB |
Output is correct |
36 |
Correct |
143 ms |
504 KB |
Output is correct |
37 |
Correct |
539 ms |
648 KB |
Output is correct |
38 |
Correct |
531 ms |
760 KB |
Output is correct |
39 |
Correct |
723 ms |
512 KB |
Output is correct |
40 |
Correct |
943 ms |
788 KB |
Output is correct |
41 |
Correct |
870 ms |
504 KB |
Output is correct |
42 |
Correct |
802 ms |
632 KB |
Output is correct |
43 |
Correct |
702 ms |
896 KB |
Output is correct |
44 |
Correct |
745 ms |
928 KB |
Output is correct |
45 |
Correct |
739 ms |
888 KB |
Output is correct |
46 |
Correct |
924 ms |
508 KB |
Output is correct |
47 |
Correct |
807 ms |
760 KB |
Output is correct |
48 |
Correct |
733 ms |
760 KB |
Output is correct |
49 |
Correct |
735 ms |
632 KB |
Output is correct |
50 |
Correct |
979 ms |
760 KB |
Output is correct |
51 |
Correct |
6 ms |
420 KB |
Output is correct |
52 |
Correct |
861 ms |
988 KB |
Output is correct |
53 |
Incorrect |
366 ms |
672 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |