답안 #887961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887961 2023-12-15T15:32:48 Z alex_2008 Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 13336 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_set>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <fstream>
#include <random>
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
const int N = 510;
const int M = 500010;
int a[N];
bitset <M> b[N];
bool ch[N][2 * M];
int main() {
	int n, sm = 0;
	cin >> n;
	bitset <M> w;
	w[0] = 1;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (a[i] % 2 != a[1] % 2) {
			cout << "0\n";
			return 0;
		}
		w |= (w << a[i]);
		sm += a[i];
	}
	if (sm % 2 == 1) {
		cout << "0\n";
		return 0;
	}
	if (!w[sm / 2]) {
		cout << "0\n";
		return 0;
	}
	bitset <M> answ;
	answ.set();
	for (int i = 1; i <= n; i++) {
		b[i][250000] = 1;
		for (int j = 1; j <= n; j++) {
			if (i == j) continue;
			b[i] = ((b[i] << a[j]) | (b[i] >> a[j]));
		}
		answ &= b[i];
	}
	vector <int> ans;
	for (int j = 250001; j <= 500000; j++) {
		if (answ[j]) ans.push_back(j - 250000);
	}
	cout << (int)ans.size() << "\n";
	for (auto it : ans) {
		cout << it << " ";
	}
	cout << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
10 Correct 25 ms 4580 KB Output is correct
11 Correct 23 ms 4848 KB Output is correct
12 Correct 25 ms 4816 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 20 ms 2652 KB Output is correct
15 Correct 20 ms 3052 KB Output is correct
16 Correct 23 ms 4692 KB Output is correct
17 Correct 10 ms 2652 KB Output is correct
18 Correct 15 ms 2652 KB Output is correct
19 Correct 17 ms 2652 KB Output is correct
20 Correct 23 ms 4824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
10 Correct 25 ms 4580 KB Output is correct
11 Correct 23 ms 4848 KB Output is correct
12 Correct 25 ms 4816 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 20 ms 2652 KB Output is correct
15 Correct 20 ms 3052 KB Output is correct
16 Correct 23 ms 4692 KB Output is correct
17 Correct 10 ms 2652 KB Output is correct
18 Correct 15 ms 2652 KB Output is correct
19 Correct 17 ms 2652 KB Output is correct
20 Correct 23 ms 4824 KB Output is correct
21 Correct 103 ms 4832 KB Output is correct
22 Correct 139 ms 5456 KB Output is correct
23 Correct 61 ms 4824 KB Output is correct
24 Correct 229 ms 6868 KB Output is correct
25 Correct 215 ms 6632 KB Output is correct
26 Correct 275 ms 8784 KB Output is correct
27 Correct 245 ms 8784 KB Output is correct
28 Correct 246 ms 8784 KB Output is correct
29 Correct 252 ms 8924 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 257 ms 8864 KB Output is correct
32 Correct 248 ms 8788 KB Output is correct
33 Correct 249 ms 8936 KB Output is correct
34 Correct 243 ms 8936 KB Output is correct
35 Correct 249 ms 8784 KB Output is correct
36 Correct 251 ms 8788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
10 Correct 25 ms 4580 KB Output is correct
11 Correct 23 ms 4848 KB Output is correct
12 Correct 25 ms 4816 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 20 ms 2652 KB Output is correct
15 Correct 20 ms 3052 KB Output is correct
16 Correct 23 ms 4692 KB Output is correct
17 Correct 10 ms 2652 KB Output is correct
18 Correct 15 ms 2652 KB Output is correct
19 Correct 17 ms 2652 KB Output is correct
20 Correct 23 ms 4824 KB Output is correct
21 Correct 103 ms 4832 KB Output is correct
22 Correct 139 ms 5456 KB Output is correct
23 Correct 61 ms 4824 KB Output is correct
24 Correct 229 ms 6868 KB Output is correct
25 Correct 215 ms 6632 KB Output is correct
26 Correct 275 ms 8784 KB Output is correct
27 Correct 245 ms 8784 KB Output is correct
28 Correct 246 ms 8784 KB Output is correct
29 Correct 252 ms 8924 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 257 ms 8864 KB Output is correct
32 Correct 248 ms 8788 KB Output is correct
33 Correct 249 ms 8936 KB Output is correct
34 Correct 243 ms 8936 KB Output is correct
35 Correct 249 ms 8784 KB Output is correct
36 Correct 251 ms 8788 KB Output is correct
37 Execution timed out 1008 ms 13336 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
10 Correct 25 ms 4580 KB Output is correct
11 Correct 23 ms 4848 KB Output is correct
12 Correct 25 ms 4816 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 20 ms 2652 KB Output is correct
15 Correct 20 ms 3052 KB Output is correct
16 Correct 23 ms 4692 KB Output is correct
17 Correct 10 ms 2652 KB Output is correct
18 Correct 15 ms 2652 KB Output is correct
19 Correct 17 ms 2652 KB Output is correct
20 Correct 23 ms 4824 KB Output is correct
21 Correct 103 ms 4832 KB Output is correct
22 Correct 139 ms 5456 KB Output is correct
23 Correct 61 ms 4824 KB Output is correct
24 Correct 229 ms 6868 KB Output is correct
25 Correct 215 ms 6632 KB Output is correct
26 Correct 275 ms 8784 KB Output is correct
27 Correct 245 ms 8784 KB Output is correct
28 Correct 246 ms 8784 KB Output is correct
29 Correct 252 ms 8924 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 257 ms 8864 KB Output is correct
32 Correct 248 ms 8788 KB Output is correct
33 Correct 249 ms 8936 KB Output is correct
34 Correct 243 ms 8936 KB Output is correct
35 Correct 249 ms 8784 KB Output is correct
36 Correct 251 ms 8788 KB Output is correct
37 Execution timed out 1008 ms 13336 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2532 KB Output is correct
2 Correct 2 ms 2648 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 4 ms 2796 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 0 ms 748 KB Output is correct
10 Correct 25 ms 4580 KB Output is correct
11 Correct 23 ms 4848 KB Output is correct
12 Correct 25 ms 4816 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 20 ms 2652 KB Output is correct
15 Correct 20 ms 3052 KB Output is correct
16 Correct 23 ms 4692 KB Output is correct
17 Correct 10 ms 2652 KB Output is correct
18 Correct 15 ms 2652 KB Output is correct
19 Correct 17 ms 2652 KB Output is correct
20 Correct 23 ms 4824 KB Output is correct
21 Correct 103 ms 4832 KB Output is correct
22 Correct 139 ms 5456 KB Output is correct
23 Correct 61 ms 4824 KB Output is correct
24 Correct 229 ms 6868 KB Output is correct
25 Correct 215 ms 6632 KB Output is correct
26 Correct 275 ms 8784 KB Output is correct
27 Correct 245 ms 8784 KB Output is correct
28 Correct 246 ms 8784 KB Output is correct
29 Correct 252 ms 8924 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 257 ms 8864 KB Output is correct
32 Correct 248 ms 8788 KB Output is correct
33 Correct 249 ms 8936 KB Output is correct
34 Correct 243 ms 8936 KB Output is correct
35 Correct 249 ms 8784 KB Output is correct
36 Correct 251 ms 8788 KB Output is correct
37 Execution timed out 1008 ms 13336 KB Time limit exceeded
38 Halted 0 ms 0 KB -