답안 #523844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523844 2022-02-08T09:27:34 Z Bill_00 Bootfall (IZhO17_bootfall) C++14
44 / 100
1000 ms 844 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<250001> 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];
			}
		}
		for(int j = 0; j <= sum; j++){
			if(BS[j] == 1){
				g[abs(sum - 2 * j)] = 1;
			}
		}
		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 << ' ';



	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 9 ms 468 KB Output is correct
11 Correct 9 ms 460 KB Output is correct
12 Correct 9 ms 460 KB Output is correct
13 Correct 7 ms 460 KB Output is correct
14 Correct 8 ms 472 KB Output is correct
15 Correct 11 ms 468 KB Output is correct
16 Correct 9 ms 472 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 7 ms 472 KB Output is correct
19 Correct 7 ms 464 KB Output is correct
20 Correct 13 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 9 ms 468 KB Output is correct
11 Correct 9 ms 460 KB Output is correct
12 Correct 9 ms 460 KB Output is correct
13 Correct 7 ms 460 KB Output is correct
14 Correct 8 ms 472 KB Output is correct
15 Correct 11 ms 468 KB Output is correct
16 Correct 9 ms 472 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 7 ms 472 KB Output is correct
19 Correct 7 ms 464 KB Output is correct
20 Correct 13 ms 460 KB Output is correct
21 Correct 52 ms 456 KB Output is correct
22 Correct 50 ms 460 KB Output is correct
23 Correct 23 ms 596 KB Output is correct
24 Correct 78 ms 460 KB Output is correct
25 Correct 79 ms 580 KB Output is correct
26 Correct 89 ms 460 KB Output is correct
27 Correct 97 ms 464 KB Output is correct
28 Correct 85 ms 460 KB Output is correct
29 Correct 87 ms 460 KB Output is correct
30 Correct 88 ms 460 KB Output is correct
31 Correct 92 ms 460 KB Output is correct
32 Correct 99 ms 460 KB Output is correct
33 Correct 90 ms 460 KB Output is correct
34 Correct 90 ms 460 KB Output is correct
35 Correct 84 ms 460 KB Output is correct
36 Correct 122 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 9 ms 468 KB Output is correct
11 Correct 9 ms 460 KB Output is correct
12 Correct 9 ms 460 KB Output is correct
13 Correct 7 ms 460 KB Output is correct
14 Correct 8 ms 472 KB Output is correct
15 Correct 11 ms 468 KB Output is correct
16 Correct 9 ms 472 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 7 ms 472 KB Output is correct
19 Correct 7 ms 464 KB Output is correct
20 Correct 13 ms 460 KB Output is correct
21 Correct 52 ms 456 KB Output is correct
22 Correct 50 ms 460 KB Output is correct
23 Correct 23 ms 596 KB Output is correct
24 Correct 78 ms 460 KB Output is correct
25 Correct 79 ms 580 KB Output is correct
26 Correct 89 ms 460 KB Output is correct
27 Correct 97 ms 464 KB Output is correct
28 Correct 85 ms 460 KB Output is correct
29 Correct 87 ms 460 KB Output is correct
30 Correct 88 ms 460 KB Output is correct
31 Correct 92 ms 460 KB Output is correct
32 Correct 99 ms 460 KB Output is correct
33 Correct 90 ms 460 KB Output is correct
34 Correct 90 ms 460 KB Output is correct
35 Correct 84 ms 460 KB Output is correct
36 Correct 122 ms 460 KB Output is correct
37 Correct 350 ms 560 KB Output is correct
38 Correct 349 ms 580 KB Output is correct
39 Correct 632 ms 460 KB Output is correct
40 Correct 697 ms 580 KB Output is correct
41 Correct 628 ms 456 KB Output is correct
42 Correct 634 ms 584 KB Output is correct
43 Correct 561 ms 836 KB Output is correct
44 Correct 594 ms 836 KB Output is correct
45 Correct 611 ms 836 KB Output is correct
46 Correct 652 ms 588 KB Output is correct
47 Correct 537 ms 580 KB Output is correct
48 Correct 555 ms 712 KB Output is correct
49 Correct 567 ms 460 KB Output is correct
50 Correct 561 ms 584 KB Output is correct
51 Correct 3 ms 416 KB Output is correct
52 Correct 702 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 9 ms 468 KB Output is correct
11 Correct 9 ms 460 KB Output is correct
12 Correct 9 ms 460 KB Output is correct
13 Correct 7 ms 460 KB Output is correct
14 Correct 8 ms 472 KB Output is correct
15 Correct 11 ms 468 KB Output is correct
16 Correct 9 ms 472 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 7 ms 472 KB Output is correct
19 Correct 7 ms 464 KB Output is correct
20 Correct 13 ms 460 KB Output is correct
21 Correct 52 ms 456 KB Output is correct
22 Correct 50 ms 460 KB Output is correct
23 Correct 23 ms 596 KB Output is correct
24 Correct 78 ms 460 KB Output is correct
25 Correct 79 ms 580 KB Output is correct
26 Correct 89 ms 460 KB Output is correct
27 Correct 97 ms 464 KB Output is correct
28 Correct 85 ms 460 KB Output is correct
29 Correct 87 ms 460 KB Output is correct
30 Correct 88 ms 460 KB Output is correct
31 Correct 92 ms 460 KB Output is correct
32 Correct 99 ms 460 KB Output is correct
33 Correct 90 ms 460 KB Output is correct
34 Correct 90 ms 460 KB Output is correct
35 Correct 84 ms 460 KB Output is correct
36 Correct 122 ms 460 KB Output is correct
37 Correct 350 ms 560 KB Output is correct
38 Correct 349 ms 580 KB Output is correct
39 Correct 632 ms 460 KB Output is correct
40 Correct 697 ms 580 KB Output is correct
41 Correct 628 ms 456 KB Output is correct
42 Correct 634 ms 584 KB Output is correct
43 Correct 561 ms 836 KB Output is correct
44 Correct 594 ms 836 KB Output is correct
45 Correct 611 ms 836 KB Output is correct
46 Correct 652 ms 588 KB Output is correct
47 Correct 537 ms 580 KB Output is correct
48 Correct 555 ms 712 KB Output is correct
49 Correct 567 ms 460 KB Output is correct
50 Correct 561 ms 584 KB Output is correct
51 Correct 3 ms 416 KB Output is correct
52 Correct 702 ms 844 KB Output is correct
53 Correct 806 ms 712 KB Output is correct
54 Execution timed out 1014 ms 332 KB Time limit exceeded
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 9 ms 468 KB Output is correct
11 Correct 9 ms 460 KB Output is correct
12 Correct 9 ms 460 KB Output is correct
13 Correct 7 ms 460 KB Output is correct
14 Correct 8 ms 472 KB Output is correct
15 Correct 11 ms 468 KB Output is correct
16 Correct 9 ms 472 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 7 ms 472 KB Output is correct
19 Correct 7 ms 464 KB Output is correct
20 Correct 13 ms 460 KB Output is correct
21 Correct 52 ms 456 KB Output is correct
22 Correct 50 ms 460 KB Output is correct
23 Correct 23 ms 596 KB Output is correct
24 Correct 78 ms 460 KB Output is correct
25 Correct 79 ms 580 KB Output is correct
26 Correct 89 ms 460 KB Output is correct
27 Correct 97 ms 464 KB Output is correct
28 Correct 85 ms 460 KB Output is correct
29 Correct 87 ms 460 KB Output is correct
30 Correct 88 ms 460 KB Output is correct
31 Correct 92 ms 460 KB Output is correct
32 Correct 99 ms 460 KB Output is correct
33 Correct 90 ms 460 KB Output is correct
34 Correct 90 ms 460 KB Output is correct
35 Correct 84 ms 460 KB Output is correct
36 Correct 122 ms 460 KB Output is correct
37 Correct 350 ms 560 KB Output is correct
38 Correct 349 ms 580 KB Output is correct
39 Correct 632 ms 460 KB Output is correct
40 Correct 697 ms 580 KB Output is correct
41 Correct 628 ms 456 KB Output is correct
42 Correct 634 ms 584 KB Output is correct
43 Correct 561 ms 836 KB Output is correct
44 Correct 594 ms 836 KB Output is correct
45 Correct 611 ms 836 KB Output is correct
46 Correct 652 ms 588 KB Output is correct
47 Correct 537 ms 580 KB Output is correct
48 Correct 555 ms 712 KB Output is correct
49 Correct 567 ms 460 KB Output is correct
50 Correct 561 ms 584 KB Output is correct
51 Correct 3 ms 416 KB Output is correct
52 Correct 702 ms 844 KB Output is correct
53 Correct 806 ms 712 KB Output is correct
54 Execution timed out 1014 ms 332 KB Time limit exceeded
55 Halted 0 ms 0 KB -