Submission #345001

# Submission time Handle Problem Language Result Execution time Memory
345001 2021-01-06T21:15:09 Z _ani Bootfall (IZhO17_bootfall) C++17
28 / 100
217 ms 262148 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
const int N = 270;
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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 16 ms 8428 KB Output is correct
11 Correct 13 ms 8428 KB Output is correct
12 Correct 13 ms 8428 KB Output is correct
13 Correct 11 ms 6508 KB Output is correct
14 Correct 13 ms 7408 KB Output is correct
15 Correct 13 ms 7404 KB Output is correct
16 Correct 13 ms 8428 KB Output is correct
17 Correct 6 ms 3308 KB Output is correct
18 Correct 9 ms 5612 KB Output is correct
19 Correct 10 ms 6508 KB Output is correct
20 Correct 13 ms 8428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 16 ms 8428 KB Output is correct
11 Correct 13 ms 8428 KB Output is correct
12 Correct 13 ms 8428 KB Output is correct
13 Correct 11 ms 6508 KB Output is correct
14 Correct 13 ms 7408 KB Output is correct
15 Correct 13 ms 7404 KB Output is correct
16 Correct 13 ms 8428 KB Output is correct
17 Correct 6 ms 3308 KB Output is correct
18 Correct 9 ms 5612 KB Output is correct
19 Correct 10 ms 6508 KB Output is correct
20 Correct 13 ms 8428 KB Output is correct
21 Correct 49 ms 37100 KB Output is correct
22 Correct 61 ms 49388 KB Output is correct
23 Correct 30 ms 22764 KB Output is correct
24 Correct 102 ms 79420 KB Output is correct
25 Correct 91 ms 79468 KB Output is correct
26 Correct 109 ms 89836 KB Output is correct
27 Correct 105 ms 89836 KB Output is correct
28 Correct 103 ms 89836 KB Output is correct
29 Correct 101 ms 89836 KB Output is correct
30 Correct 101 ms 89836 KB Output is correct
31 Correct 102 ms 89836 KB Output is correct
32 Correct 106 ms 89836 KB Output is correct
33 Correct 101 ms 89836 KB Output is correct
34 Correct 101 ms 89836 KB Output is correct
35 Correct 100 ms 89824 KB Output is correct
36 Correct 102 ms 89836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 16 ms 8428 KB Output is correct
11 Correct 13 ms 8428 KB Output is correct
12 Correct 13 ms 8428 KB Output is correct
13 Correct 11 ms 6508 KB Output is correct
14 Correct 13 ms 7408 KB Output is correct
15 Correct 13 ms 7404 KB Output is correct
16 Correct 13 ms 8428 KB Output is correct
17 Correct 6 ms 3308 KB Output is correct
18 Correct 9 ms 5612 KB Output is correct
19 Correct 10 ms 6508 KB Output is correct
20 Correct 13 ms 8428 KB Output is correct
21 Correct 49 ms 37100 KB Output is correct
22 Correct 61 ms 49388 KB Output is correct
23 Correct 30 ms 22764 KB Output is correct
24 Correct 102 ms 79420 KB Output is correct
25 Correct 91 ms 79468 KB Output is correct
26 Correct 109 ms 89836 KB Output is correct
27 Correct 105 ms 89836 KB Output is correct
28 Correct 103 ms 89836 KB Output is correct
29 Correct 101 ms 89836 KB Output is correct
30 Correct 101 ms 89836 KB Output is correct
31 Correct 102 ms 89836 KB Output is correct
32 Correct 106 ms 89836 KB Output is correct
33 Correct 101 ms 89836 KB Output is correct
34 Correct 101 ms 89836 KB Output is correct
35 Correct 100 ms 89824 KB Output is correct
36 Correct 102 ms 89836 KB Output is correct
37 Runtime error 217 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 16 ms 8428 KB Output is correct
11 Correct 13 ms 8428 KB Output is correct
12 Correct 13 ms 8428 KB Output is correct
13 Correct 11 ms 6508 KB Output is correct
14 Correct 13 ms 7408 KB Output is correct
15 Correct 13 ms 7404 KB Output is correct
16 Correct 13 ms 8428 KB Output is correct
17 Correct 6 ms 3308 KB Output is correct
18 Correct 9 ms 5612 KB Output is correct
19 Correct 10 ms 6508 KB Output is correct
20 Correct 13 ms 8428 KB Output is correct
21 Correct 49 ms 37100 KB Output is correct
22 Correct 61 ms 49388 KB Output is correct
23 Correct 30 ms 22764 KB Output is correct
24 Correct 102 ms 79420 KB Output is correct
25 Correct 91 ms 79468 KB Output is correct
26 Correct 109 ms 89836 KB Output is correct
27 Correct 105 ms 89836 KB Output is correct
28 Correct 103 ms 89836 KB Output is correct
29 Correct 101 ms 89836 KB Output is correct
30 Correct 101 ms 89836 KB Output is correct
31 Correct 102 ms 89836 KB Output is correct
32 Correct 106 ms 89836 KB Output is correct
33 Correct 101 ms 89836 KB Output is correct
34 Correct 101 ms 89836 KB Output is correct
35 Correct 100 ms 89824 KB Output is correct
36 Correct 102 ms 89836 KB Output is correct
37 Runtime error 217 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 1644 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 4 ms 1644 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 16 ms 8428 KB Output is correct
11 Correct 13 ms 8428 KB Output is correct
12 Correct 13 ms 8428 KB Output is correct
13 Correct 11 ms 6508 KB Output is correct
14 Correct 13 ms 7408 KB Output is correct
15 Correct 13 ms 7404 KB Output is correct
16 Correct 13 ms 8428 KB Output is correct
17 Correct 6 ms 3308 KB Output is correct
18 Correct 9 ms 5612 KB Output is correct
19 Correct 10 ms 6508 KB Output is correct
20 Correct 13 ms 8428 KB Output is correct
21 Correct 49 ms 37100 KB Output is correct
22 Correct 61 ms 49388 KB Output is correct
23 Correct 30 ms 22764 KB Output is correct
24 Correct 102 ms 79420 KB Output is correct
25 Correct 91 ms 79468 KB Output is correct
26 Correct 109 ms 89836 KB Output is correct
27 Correct 105 ms 89836 KB Output is correct
28 Correct 103 ms 89836 KB Output is correct
29 Correct 101 ms 89836 KB Output is correct
30 Correct 101 ms 89836 KB Output is correct
31 Correct 102 ms 89836 KB Output is correct
32 Correct 106 ms 89836 KB Output is correct
33 Correct 101 ms 89836 KB Output is correct
34 Correct 101 ms 89836 KB Output is correct
35 Correct 100 ms 89824 KB Output is correct
36 Correct 102 ms 89836 KB Output is correct
37 Runtime error 217 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Halted 0 ms 0 KB -