답안 #345000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345000 2021-01-06T21:13:54 Z _ani Bootfall (IZhO17_bootfall) C++17
28 / 100
228 ms 262144 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
const int N = 300;
vector<int> a, ans;
int SUM;
bitset<N* N> dp[N + 1][N + 1];
bitset<N* N> hrashq[N + 1];
int isok[N * N];
int main()
{
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		SUM += a[i];
	}
	bool skzb = false;
	for (int jnj = 0; jnj < n; jnj++) {
		auto b = a;
		b.erase(b.begin() + jnj);
		for (int i = 0; i < n - 1; i++) {
			if (i - 1 < 0)
				dp[jnj][i][0] = dp[jnj][i][b[i]] = 1;
			else dp[jnj][i] = ((dp[jnj][i - 1] << b[i]) | dp[jnj][i - 1]);
		}
	}
	for (int jnj = 0; jnj < n; jnj++)
	{
		for (int i = 0; i < n - 1; i++)
			hrashq[jnj] |= dp[jnj][i];
		if (hrashq[jnj][SUM / 2])skzb = true;
	}
	if (SUM % 2)skzb = false;
	for (int i = 1; i <= N * N; i++) {
		bool ok = true;
		int cs = i + SUM;
		for (int jnj = 0; jnj < n; jnj++) {
			int ccs = cs - a[jnj];
			if (ccs > N * N) {
				ok = false;
				break;
			}
			if (!hrashq[jnj][ccs / 2])
				ok = false;
			if (ccs % 2)ok = false;
		}
		if (ok && skzb)ans.push_back(i);
	}
	cout << ans.size() << '\n';
	for (int a : ans)
		cout << a << ' ';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
10 Correct 16 ms 10348 KB Output is correct
11 Correct 17 ms 10348 KB Output is correct
12 Correct 21 ms 10348 KB Output is correct
13 Correct 15 ms 7788 KB Output is correct
14 Correct 15 ms 9068 KB Output is correct
15 Correct 15 ms 9068 KB Output is correct
16 Correct 18 ms 10348 KB Output is correct
17 Correct 7 ms 3948 KB Output is correct
18 Correct 13 ms 6764 KB Output is correct
19 Correct 13 ms 7788 KB Output is correct
20 Correct 16 ms 10348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
10 Correct 16 ms 10348 KB Output is correct
11 Correct 17 ms 10348 KB Output is correct
12 Correct 21 ms 10348 KB Output is correct
13 Correct 15 ms 7788 KB Output is correct
14 Correct 15 ms 9068 KB Output is correct
15 Correct 15 ms 9068 KB Output is correct
16 Correct 18 ms 10348 KB Output is correct
17 Correct 7 ms 3948 KB Output is correct
18 Correct 13 ms 6764 KB Output is correct
19 Correct 13 ms 7788 KB Output is correct
20 Correct 16 ms 10348 KB Output is correct
21 Correct 57 ms 45676 KB Output is correct
22 Correct 74 ms 60780 KB Output is correct
23 Correct 38 ms 28012 KB Output is correct
24 Correct 121 ms 97772 KB Output is correct
25 Correct 113 ms 97820 KB Output is correct
26 Correct 129 ms 110700 KB Output is correct
27 Correct 122 ms 110572 KB Output is correct
28 Correct 123 ms 110572 KB Output is correct
29 Correct 123 ms 110644 KB Output is correct
30 Correct 128 ms 110592 KB Output is correct
31 Correct 125 ms 110716 KB Output is correct
32 Correct 125 ms 110572 KB Output is correct
33 Correct 126 ms 110700 KB Output is correct
34 Correct 133 ms 110700 KB Output is correct
35 Correct 126 ms 110700 KB Output is correct
36 Correct 133 ms 110572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
10 Correct 16 ms 10348 KB Output is correct
11 Correct 17 ms 10348 KB Output is correct
12 Correct 21 ms 10348 KB Output is correct
13 Correct 15 ms 7788 KB Output is correct
14 Correct 15 ms 9068 KB Output is correct
15 Correct 15 ms 9068 KB Output is correct
16 Correct 18 ms 10348 KB Output is correct
17 Correct 7 ms 3948 KB Output is correct
18 Correct 13 ms 6764 KB Output is correct
19 Correct 13 ms 7788 KB Output is correct
20 Correct 16 ms 10348 KB Output is correct
21 Correct 57 ms 45676 KB Output is correct
22 Correct 74 ms 60780 KB Output is correct
23 Correct 38 ms 28012 KB Output is correct
24 Correct 121 ms 97772 KB Output is correct
25 Correct 113 ms 97820 KB Output is correct
26 Correct 129 ms 110700 KB Output is correct
27 Correct 122 ms 110572 KB Output is correct
28 Correct 123 ms 110572 KB Output is correct
29 Correct 123 ms 110644 KB Output is correct
30 Correct 128 ms 110592 KB Output is correct
31 Correct 125 ms 110716 KB Output is correct
32 Correct 125 ms 110572 KB Output is correct
33 Correct 126 ms 110700 KB Output is correct
34 Correct 133 ms 110700 KB Output is correct
35 Correct 126 ms 110700 KB Output is correct
36 Correct 133 ms 110572 KB Output is correct
37 Runtime error 228 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
10 Correct 16 ms 10348 KB Output is correct
11 Correct 17 ms 10348 KB Output is correct
12 Correct 21 ms 10348 KB Output is correct
13 Correct 15 ms 7788 KB Output is correct
14 Correct 15 ms 9068 KB Output is correct
15 Correct 15 ms 9068 KB Output is correct
16 Correct 18 ms 10348 KB Output is correct
17 Correct 7 ms 3948 KB Output is correct
18 Correct 13 ms 6764 KB Output is correct
19 Correct 13 ms 7788 KB Output is correct
20 Correct 16 ms 10348 KB Output is correct
21 Correct 57 ms 45676 KB Output is correct
22 Correct 74 ms 60780 KB Output is correct
23 Correct 38 ms 28012 KB Output is correct
24 Correct 121 ms 97772 KB Output is correct
25 Correct 113 ms 97820 KB Output is correct
26 Correct 129 ms 110700 KB Output is correct
27 Correct 122 ms 110572 KB Output is correct
28 Correct 123 ms 110572 KB Output is correct
29 Correct 123 ms 110644 KB Output is correct
30 Correct 128 ms 110592 KB Output is correct
31 Correct 125 ms 110716 KB Output is correct
32 Correct 125 ms 110572 KB Output is correct
33 Correct 126 ms 110700 KB Output is correct
34 Correct 133 ms 110700 KB Output is correct
35 Correct 126 ms 110700 KB Output is correct
36 Correct 133 ms 110572 KB Output is correct
37 Runtime error 228 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 3 ms 1004 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 3 ms 1516 KB Output is correct
10 Correct 16 ms 10348 KB Output is correct
11 Correct 17 ms 10348 KB Output is correct
12 Correct 21 ms 10348 KB Output is correct
13 Correct 15 ms 7788 KB Output is correct
14 Correct 15 ms 9068 KB Output is correct
15 Correct 15 ms 9068 KB Output is correct
16 Correct 18 ms 10348 KB Output is correct
17 Correct 7 ms 3948 KB Output is correct
18 Correct 13 ms 6764 KB Output is correct
19 Correct 13 ms 7788 KB Output is correct
20 Correct 16 ms 10348 KB Output is correct
21 Correct 57 ms 45676 KB Output is correct
22 Correct 74 ms 60780 KB Output is correct
23 Correct 38 ms 28012 KB Output is correct
24 Correct 121 ms 97772 KB Output is correct
25 Correct 113 ms 97820 KB Output is correct
26 Correct 129 ms 110700 KB Output is correct
27 Correct 122 ms 110572 KB Output is correct
28 Correct 123 ms 110572 KB Output is correct
29 Correct 123 ms 110644 KB Output is correct
30 Correct 128 ms 110592 KB Output is correct
31 Correct 125 ms 110716 KB Output is correct
32 Correct 125 ms 110572 KB Output is correct
33 Correct 126 ms 110700 KB Output is correct
34 Correct 133 ms 110700 KB Output is correct
35 Correct 126 ms 110700 KB Output is correct
36 Correct 133 ms 110572 KB Output is correct
37 Runtime error 228 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -