Submission #344993

# Submission time Handle Problem Language Result Execution time Memory
344993 2021-01-06T21:08:40 Z _ani Bootfall (IZhO17_bootfall) C++17
13 / 100
15 ms 11628 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
const int N = 100;
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 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 3 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1276 KB Output is correct
14 Correct 2 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 3 ms 1516 KB Output is correct
17 Correct 1 ms 876 KB Output is correct
18 Correct 2 ms 1132 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 3 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1276 KB Output is correct
14 Correct 2 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 3 ms 1516 KB Output is correct
17 Correct 1 ms 876 KB Output is correct
18 Correct 2 ms 1132 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 8 ms 5612 KB Output is correct
22 Correct 10 ms 7404 KB Output is correct
23 Correct 5 ms 3564 KB Output is correct
24 Correct 15 ms 11628 KB Output is correct
25 Incorrect 13 ms 11624 KB Output isn't correct
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 3 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1276 KB Output is correct
14 Correct 2 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 3 ms 1516 KB Output is correct
17 Correct 1 ms 876 KB Output is correct
18 Correct 2 ms 1132 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 8 ms 5612 KB Output is correct
22 Correct 10 ms 7404 KB Output is correct
23 Correct 5 ms 3564 KB Output is correct
24 Correct 15 ms 11628 KB Output is correct
25 Incorrect 13 ms 11624 KB Output isn't correct
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 3 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1276 KB Output is correct
14 Correct 2 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 3 ms 1516 KB Output is correct
17 Correct 1 ms 876 KB Output is correct
18 Correct 2 ms 1132 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 8 ms 5612 KB Output is correct
22 Correct 10 ms 7404 KB Output is correct
23 Correct 5 ms 3564 KB Output is correct
24 Correct 15 ms 11628 KB Output is correct
25 Incorrect 13 ms 11624 KB Output isn't correct
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 3 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1276 KB Output is correct
14 Correct 2 ms 1388 KB Output is correct
15 Correct 2 ms 1388 KB Output is correct
16 Correct 3 ms 1516 KB Output is correct
17 Correct 1 ms 876 KB Output is correct
18 Correct 2 ms 1132 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 8 ms 5612 KB Output is correct
22 Correct 10 ms 7404 KB Output is correct
23 Correct 5 ms 3564 KB Output is correct
24 Correct 15 ms 11628 KB Output is correct
25 Incorrect 13 ms 11624 KB Output isn't correct
26 Halted 0 ms 0 KB -