답안 #344970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344970 2021-01-06T20:23:12 Z _ani Bootfall (IZhO17_bootfall) C++17
13 / 100
520 ms 262148 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int N = 100;
vector<int> a, ans;
int SUM;
int dp[N + 1][N + 1][N * N + 1];
int hrashq[N + 1][N * N + 1];
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++)
			for (int sum = 0; sum <= N * N; sum++) {
				if (i - 1 < 0)
					dp[jnj][i][0] = dp[jnj][i][b[i]] = 1;
				else {
					dp[jnj][i][sum] = max(dp[jnj][i][sum], dp[jnj][i - 1][sum]);
					if (sum - b[i] >= 0)
						dp[jnj][i][sum] = max(dp[jnj][i][sum], dp[jnj][i - 1][sum - b[i]]);
				}
				if (sum == SUM / 2 && dp[jnj][i][sum])skzb = true;
			}
	}
	if (SUM % 2)skzb = false;
	for (int i = 1; i <= N * N; i++)
	{
		bool ok = true;
		for (int jnj = 0; jnj < n; jnj++)
		{
			int cursum = i - a[jnj] + SUM;
			if (cursum % 2 || cursum > N * N) {
				ok = false;
				break;
			}
			bool lavalava = false;
			for (int k = 0; k < n - 1; k++)
				if (dp[jnj][k][cursum / 2] == 1)
					lavalava = true;
			if (!lavalava)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 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
10 Correct 60 ms 33516 KB Output is correct
11 Correct 64 ms 33644 KB Output is correct
12 Correct 62 ms 33644 KB Output is correct
13 Correct 43 ms 25068 KB Output is correct
14 Correct 49 ms 29164 KB Output is correct
15 Correct 51 ms 29164 KB Output is correct
16 Correct 59 ms 33516 KB Output is correct
17 Correct 18 ms 11756 KB Output is correct
18 Correct 32 ms 21228 KB Output is correct
19 Correct 40 ms 25068 KB Output is correct
20 Correct 61 ms 33644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
10 Correct 60 ms 33516 KB Output is correct
11 Correct 64 ms 33644 KB Output is correct
12 Correct 62 ms 33644 KB Output is correct
13 Correct 43 ms 25068 KB Output is correct
14 Correct 49 ms 29164 KB Output is correct
15 Correct 51 ms 29164 KB Output is correct
16 Correct 59 ms 33516 KB Output is correct
17 Correct 18 ms 11756 KB Output is correct
18 Correct 32 ms 21228 KB Output is correct
19 Correct 40 ms 25068 KB Output is correct
20 Correct 61 ms 33644 KB Output is correct
21 Correct 425 ms 156524 KB Output is correct
22 Correct 520 ms 209644 KB Output is correct
23 Correct 259 ms 95084 KB Output is correct
24 Runtime error 384 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
10 Correct 60 ms 33516 KB Output is correct
11 Correct 64 ms 33644 KB Output is correct
12 Correct 62 ms 33644 KB Output is correct
13 Correct 43 ms 25068 KB Output is correct
14 Correct 49 ms 29164 KB Output is correct
15 Correct 51 ms 29164 KB Output is correct
16 Correct 59 ms 33516 KB Output is correct
17 Correct 18 ms 11756 KB Output is correct
18 Correct 32 ms 21228 KB Output is correct
19 Correct 40 ms 25068 KB Output is correct
20 Correct 61 ms 33644 KB Output is correct
21 Correct 425 ms 156524 KB Output is correct
22 Correct 520 ms 209644 KB Output is correct
23 Correct 259 ms 95084 KB Output is correct
24 Runtime error 384 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
10 Correct 60 ms 33516 KB Output is correct
11 Correct 64 ms 33644 KB Output is correct
12 Correct 62 ms 33644 KB Output is correct
13 Correct 43 ms 25068 KB Output is correct
14 Correct 49 ms 29164 KB Output is correct
15 Correct 51 ms 29164 KB Output is correct
16 Correct 59 ms 33516 KB Output is correct
17 Correct 18 ms 11756 KB Output is correct
18 Correct 32 ms 21228 KB Output is correct
19 Correct 40 ms 25068 KB Output is correct
20 Correct 61 ms 33644 KB Output is correct
21 Correct 425 ms 156524 KB Output is correct
22 Correct 520 ms 209644 KB Output is correct
23 Correct 259 ms 95084 KB Output is correct
24 Runtime error 384 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 896 KB Output is correct
2 Correct 2 ms 1388 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 748 KB Output is correct
5 Correct 8 ms 5100 KB Output is correct
6 Correct 4 ms 2284 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 8 ms 5228 KB Output is correct
9 Correct 5 ms 3564 KB Output is correct
10 Correct 60 ms 33516 KB Output is correct
11 Correct 64 ms 33644 KB Output is correct
12 Correct 62 ms 33644 KB Output is correct
13 Correct 43 ms 25068 KB Output is correct
14 Correct 49 ms 29164 KB Output is correct
15 Correct 51 ms 29164 KB Output is correct
16 Correct 59 ms 33516 KB Output is correct
17 Correct 18 ms 11756 KB Output is correct
18 Correct 32 ms 21228 KB Output is correct
19 Correct 40 ms 25068 KB Output is correct
20 Correct 61 ms 33644 KB Output is correct
21 Correct 425 ms 156524 KB Output is correct
22 Correct 520 ms 209644 KB Output is correct
23 Correct 259 ms 95084 KB Output is correct
24 Runtime error 384 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -