Submission #523841

# Submission time Handle Problem Language Result Execution time Memory
523841 2022-02-08T09:18:24 Z Bill_00 Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 736 KB
#include<bits/stdc++.h>
#pragma GCC target("popcnt")
#define N 1000005
typedef long long ll;

using namespace std;

int a[N];
int n;
int sum;
bitset<500000> BS, ans, g;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for(int i = 1; i <= 250000; i++){
		ans[i] = 1;
	}
	int n;
	cin >> n;

	BS[0] = 1;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		sum += a[i];
		BS = BS | (BS << a[i]);
	}

	if(sum % 2 == 0){
		int k = sum >> 1;
		if(BS[k] == 0){
			cout << 0;
			return 0;
		}
	}
	else{
		cout << 0;
		return 0;
	}

	for(int i = 1; i <= n; i++){
		BS.reset();
		g.reset();
		sum = 0;
		BS[0] = 1;
		for(int j = 1; j <= n; j++){
			if(i != j){
				BS = BS | (BS << a[j]);
				sum += a[j];
			}
		}
		int k = BS._Find_first();
		while(k < sum){
			g[abs(sum - 2 * k)] = 1;
			BS[k] = 0;
			k = BS._Find_first();
		}
		ans &= g;
	}
	vector<int> anss;
	for(int i = 1; i <= 250000; i++){
		if(ans[i] == 1){
			anss.push_back(i);
		}
	}
	cout << anss.size() << '\n';
	for(int value : anss) cout << value << ' ';



	
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 21 ms 624 KB Output is correct
11 Correct 18 ms 588 KB Output is correct
12 Correct 22 ms 604 KB Output is correct
13 Correct 15 ms 624 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 16 ms 628 KB Output is correct
16 Correct 19 ms 588 KB Output is correct
17 Correct 8 ms 624 KB Output is correct
18 Correct 12 ms 628 KB Output is correct
19 Correct 14 ms 588 KB Output is correct
20 Correct 19 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 21 ms 624 KB Output is correct
11 Correct 18 ms 588 KB Output is correct
12 Correct 22 ms 604 KB Output is correct
13 Correct 15 ms 624 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 16 ms 628 KB Output is correct
16 Correct 19 ms 588 KB Output is correct
17 Correct 8 ms 624 KB Output is correct
18 Correct 12 ms 628 KB Output is correct
19 Correct 14 ms 588 KB Output is correct
20 Correct 19 ms 588 KB Output is correct
21 Correct 83 ms 608 KB Output is correct
22 Correct 109 ms 604 KB Output is correct
23 Correct 48 ms 588 KB Output is correct
24 Correct 175 ms 616 KB Output is correct
25 Correct 190 ms 616 KB Output is correct
26 Correct 217 ms 608 KB Output is correct
27 Correct 218 ms 604 KB Output is correct
28 Correct 203 ms 616 KB Output is correct
29 Correct 205 ms 716 KB Output is correct
30 Correct 199 ms 588 KB Output is correct
31 Correct 214 ms 604 KB Output is correct
32 Correct 201 ms 624 KB Output is correct
33 Correct 187 ms 608 KB Output is correct
34 Correct 185 ms 588 KB Output is correct
35 Correct 209 ms 604 KB Output is correct
36 Correct 211 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 21 ms 624 KB Output is correct
11 Correct 18 ms 588 KB Output is correct
12 Correct 22 ms 604 KB Output is correct
13 Correct 15 ms 624 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 16 ms 628 KB Output is correct
16 Correct 19 ms 588 KB Output is correct
17 Correct 8 ms 624 KB Output is correct
18 Correct 12 ms 628 KB Output is correct
19 Correct 14 ms 588 KB Output is correct
20 Correct 19 ms 588 KB Output is correct
21 Correct 83 ms 608 KB Output is correct
22 Correct 109 ms 604 KB Output is correct
23 Correct 48 ms 588 KB Output is correct
24 Correct 175 ms 616 KB Output is correct
25 Correct 190 ms 616 KB Output is correct
26 Correct 217 ms 608 KB Output is correct
27 Correct 218 ms 604 KB Output is correct
28 Correct 203 ms 616 KB Output is correct
29 Correct 205 ms 716 KB Output is correct
30 Correct 199 ms 588 KB Output is correct
31 Correct 214 ms 604 KB Output is correct
32 Correct 201 ms 624 KB Output is correct
33 Correct 187 ms 608 KB Output is correct
34 Correct 185 ms 588 KB Output is correct
35 Correct 209 ms 604 KB Output is correct
36 Correct 211 ms 620 KB Output is correct
37 Execution timed out 1008 ms 736 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 21 ms 624 KB Output is correct
11 Correct 18 ms 588 KB Output is correct
12 Correct 22 ms 604 KB Output is correct
13 Correct 15 ms 624 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 16 ms 628 KB Output is correct
16 Correct 19 ms 588 KB Output is correct
17 Correct 8 ms 624 KB Output is correct
18 Correct 12 ms 628 KB Output is correct
19 Correct 14 ms 588 KB Output is correct
20 Correct 19 ms 588 KB Output is correct
21 Correct 83 ms 608 KB Output is correct
22 Correct 109 ms 604 KB Output is correct
23 Correct 48 ms 588 KB Output is correct
24 Correct 175 ms 616 KB Output is correct
25 Correct 190 ms 616 KB Output is correct
26 Correct 217 ms 608 KB Output is correct
27 Correct 218 ms 604 KB Output is correct
28 Correct 203 ms 616 KB Output is correct
29 Correct 205 ms 716 KB Output is correct
30 Correct 199 ms 588 KB Output is correct
31 Correct 214 ms 604 KB Output is correct
32 Correct 201 ms 624 KB Output is correct
33 Correct 187 ms 608 KB Output is correct
34 Correct 185 ms 588 KB Output is correct
35 Correct 209 ms 604 KB Output is correct
36 Correct 211 ms 620 KB Output is correct
37 Execution timed out 1008 ms 736 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 21 ms 624 KB Output is correct
11 Correct 18 ms 588 KB Output is correct
12 Correct 22 ms 604 KB Output is correct
13 Correct 15 ms 624 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 16 ms 628 KB Output is correct
16 Correct 19 ms 588 KB Output is correct
17 Correct 8 ms 624 KB Output is correct
18 Correct 12 ms 628 KB Output is correct
19 Correct 14 ms 588 KB Output is correct
20 Correct 19 ms 588 KB Output is correct
21 Correct 83 ms 608 KB Output is correct
22 Correct 109 ms 604 KB Output is correct
23 Correct 48 ms 588 KB Output is correct
24 Correct 175 ms 616 KB Output is correct
25 Correct 190 ms 616 KB Output is correct
26 Correct 217 ms 608 KB Output is correct
27 Correct 218 ms 604 KB Output is correct
28 Correct 203 ms 616 KB Output is correct
29 Correct 205 ms 716 KB Output is correct
30 Correct 199 ms 588 KB Output is correct
31 Correct 214 ms 604 KB Output is correct
32 Correct 201 ms 624 KB Output is correct
33 Correct 187 ms 608 KB Output is correct
34 Correct 185 ms 588 KB Output is correct
35 Correct 209 ms 604 KB Output is correct
36 Correct 211 ms 620 KB Output is correct
37 Execution timed out 1008 ms 736 KB Time limit exceeded
38 Halted 0 ms 0 KB -