Submission #172893

# Submission time Handle Problem Language Result Execution time Memory
172893 2020-01-02T17:44:26 Z LinusTorvaldsFan Bootfall (IZhO17_bootfall) C++14
44 / 100
1000 ms 7680 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn=351;
const int maxc=500;
const int maxw=maxc*maxn;
bitset<maxn*maxc>available[maxn];



int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector<int>a(n);
	int sum=0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=0;i<=n;i++){
		available[i][0]=true;
		for(int j=0;j<n;j++){
			if(i==j)continue;
			available[i]|=available[i]<<a[j];
		}
	}
	if(sum&1){
		cout<<0;
		return 0;
	}
	vector<int>ans;
	for(int x=0;x<=maxw;x++){
		bool ok=true;
		if(!available[n][sum/2]){
			ok=false;
			break;
		}
		for(int i=0;i<n;i++){
			int nsum=sum-a[i]+x;
			if(nsum&1){
				ok=false;
				break;
			}
			if(!available[i][nsum/2]){
				ok=false;
				break;
			}
		}
		if(ok){
			ans.push_back(x);
		}
	}
	cout<<ans.size()<<endl;
	for(auto x:ans)cout<<x<<" ";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 12 ms 1020 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 12 ms 1016 KB Output is correct
13 Correct 10 ms 1016 KB Output is correct
14 Correct 11 ms 1016 KB Output is correct
15 Correct 11 ms 1016 KB Output is correct
16 Correct 12 ms 1016 KB Output is correct
17 Correct 18 ms 760 KB Output is correct
18 Correct 8 ms 888 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 12 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 12 ms 1020 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 12 ms 1016 KB Output is correct
13 Correct 10 ms 1016 KB Output is correct
14 Correct 11 ms 1016 KB Output is correct
15 Correct 11 ms 1016 KB Output is correct
16 Correct 12 ms 1016 KB Output is correct
17 Correct 18 ms 760 KB Output is correct
18 Correct 8 ms 888 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 12 ms 1016 KB Output is correct
21 Correct 42 ms 1788 KB Output is correct
22 Correct 55 ms 2036 KB Output is correct
23 Correct 27 ms 1500 KB Output is correct
24 Correct 87 ms 2552 KB Output is correct
25 Correct 87 ms 2572 KB Output is correct
26 Correct 97 ms 2524 KB Output is correct
27 Correct 97 ms 2620 KB Output is correct
28 Correct 97 ms 2612 KB Output is correct
29 Correct 96 ms 2552 KB Output is correct
30 Correct 96 ms 2680 KB Output is correct
31 Correct 96 ms 2552 KB Output is correct
32 Correct 96 ms 2552 KB Output is correct
33 Correct 97 ms 2552 KB Output is correct
34 Correct 97 ms 2552 KB Output is correct
35 Correct 96 ms 2552 KB Output is correct
36 Correct 98 ms 2608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 12 ms 1020 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 12 ms 1016 KB Output is correct
13 Correct 10 ms 1016 KB Output is correct
14 Correct 11 ms 1016 KB Output is correct
15 Correct 11 ms 1016 KB Output is correct
16 Correct 12 ms 1016 KB Output is correct
17 Correct 18 ms 760 KB Output is correct
18 Correct 8 ms 888 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 12 ms 1016 KB Output is correct
21 Correct 42 ms 1788 KB Output is correct
22 Correct 55 ms 2036 KB Output is correct
23 Correct 27 ms 1500 KB Output is correct
24 Correct 87 ms 2552 KB Output is correct
25 Correct 87 ms 2572 KB Output is correct
26 Correct 97 ms 2524 KB Output is correct
27 Correct 97 ms 2620 KB Output is correct
28 Correct 97 ms 2612 KB Output is correct
29 Correct 96 ms 2552 KB Output is correct
30 Correct 96 ms 2680 KB Output is correct
31 Correct 96 ms 2552 KB Output is correct
32 Correct 96 ms 2552 KB Output is correct
33 Correct 97 ms 2552 KB Output is correct
34 Correct 97 ms 2552 KB Output is correct
35 Correct 96 ms 2552 KB Output is correct
36 Correct 98 ms 2608 KB Output is correct
37 Correct 377 ms 4904 KB Output is correct
38 Correct 371 ms 4980 KB Output is correct
39 Correct 564 ms 5976 KB Output is correct
40 Correct 674 ms 6480 KB Output is correct
41 Correct 667 ms 6336 KB Output is correct
42 Correct 587 ms 6008 KB Output is correct
43 Correct 568 ms 6020 KB Output is correct
44 Correct 587 ms 6136 KB Output is correct
45 Correct 596 ms 6244 KB Output is correct
46 Correct 664 ms 6404 KB Output is correct
47 Correct 590 ms 6136 KB Output is correct
48 Correct 581 ms 6268 KB Output is correct
49 Correct 572 ms 6000 KB Output is correct
50 Correct 593 ms 5964 KB Output is correct
51 Correct 565 ms 5820 KB Output is correct
52 Correct 685 ms 6608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 12 ms 1020 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 12 ms 1016 KB Output is correct
13 Correct 10 ms 1016 KB Output is correct
14 Correct 11 ms 1016 KB Output is correct
15 Correct 11 ms 1016 KB Output is correct
16 Correct 12 ms 1016 KB Output is correct
17 Correct 18 ms 760 KB Output is correct
18 Correct 8 ms 888 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 12 ms 1016 KB Output is correct
21 Correct 42 ms 1788 KB Output is correct
22 Correct 55 ms 2036 KB Output is correct
23 Correct 27 ms 1500 KB Output is correct
24 Correct 87 ms 2552 KB Output is correct
25 Correct 87 ms 2572 KB Output is correct
26 Correct 97 ms 2524 KB Output is correct
27 Correct 97 ms 2620 KB Output is correct
28 Correct 97 ms 2612 KB Output is correct
29 Correct 96 ms 2552 KB Output is correct
30 Correct 96 ms 2680 KB Output is correct
31 Correct 96 ms 2552 KB Output is correct
32 Correct 96 ms 2552 KB Output is correct
33 Correct 97 ms 2552 KB Output is correct
34 Correct 97 ms 2552 KB Output is correct
35 Correct 96 ms 2552 KB Output is correct
36 Correct 98 ms 2608 KB Output is correct
37 Correct 377 ms 4904 KB Output is correct
38 Correct 371 ms 4980 KB Output is correct
39 Correct 564 ms 5976 KB Output is correct
40 Correct 674 ms 6480 KB Output is correct
41 Correct 667 ms 6336 KB Output is correct
42 Correct 587 ms 6008 KB Output is correct
43 Correct 568 ms 6020 KB Output is correct
44 Correct 587 ms 6136 KB Output is correct
45 Correct 596 ms 6244 KB Output is correct
46 Correct 664 ms 6404 KB Output is correct
47 Correct 590 ms 6136 KB Output is correct
48 Correct 581 ms 6268 KB Output is correct
49 Correct 572 ms 6000 KB Output is correct
50 Correct 593 ms 5964 KB Output is correct
51 Correct 565 ms 5820 KB Output is correct
52 Correct 685 ms 6608 KB Output is correct
53 Correct 848 ms 7420 KB Output is correct
54 Execution timed out 1069 ms 7680 KB Time limit exceeded
55 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 4 ms 632 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 4 ms 632 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 12 ms 1020 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 12 ms 1016 KB Output is correct
13 Correct 10 ms 1016 KB Output is correct
14 Correct 11 ms 1016 KB Output is correct
15 Correct 11 ms 1016 KB Output is correct
16 Correct 12 ms 1016 KB Output is correct
17 Correct 18 ms 760 KB Output is correct
18 Correct 8 ms 888 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 12 ms 1016 KB Output is correct
21 Correct 42 ms 1788 KB Output is correct
22 Correct 55 ms 2036 KB Output is correct
23 Correct 27 ms 1500 KB Output is correct
24 Correct 87 ms 2552 KB Output is correct
25 Correct 87 ms 2572 KB Output is correct
26 Correct 97 ms 2524 KB Output is correct
27 Correct 97 ms 2620 KB Output is correct
28 Correct 97 ms 2612 KB Output is correct
29 Correct 96 ms 2552 KB Output is correct
30 Correct 96 ms 2680 KB Output is correct
31 Correct 96 ms 2552 KB Output is correct
32 Correct 96 ms 2552 KB Output is correct
33 Correct 97 ms 2552 KB Output is correct
34 Correct 97 ms 2552 KB Output is correct
35 Correct 96 ms 2552 KB Output is correct
36 Correct 98 ms 2608 KB Output is correct
37 Correct 377 ms 4904 KB Output is correct
38 Correct 371 ms 4980 KB Output is correct
39 Correct 564 ms 5976 KB Output is correct
40 Correct 674 ms 6480 KB Output is correct
41 Correct 667 ms 6336 KB Output is correct
42 Correct 587 ms 6008 KB Output is correct
43 Correct 568 ms 6020 KB Output is correct
44 Correct 587 ms 6136 KB Output is correct
45 Correct 596 ms 6244 KB Output is correct
46 Correct 664 ms 6404 KB Output is correct
47 Correct 590 ms 6136 KB Output is correct
48 Correct 581 ms 6268 KB Output is correct
49 Correct 572 ms 6000 KB Output is correct
50 Correct 593 ms 5964 KB Output is correct
51 Correct 565 ms 5820 KB Output is correct
52 Correct 685 ms 6608 KB Output is correct
53 Correct 848 ms 7420 KB Output is correct
54 Execution timed out 1069 ms 7680 KB Time limit exceeded
55 Halted 0 ms 0 KB -