답안 #1009021

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009021 2024-06-27T08:00:55 Z Muaath_5 Bootfall (IZhO17_bootfall) C++17
13 / 100
1000 ms 464 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;

const int N = 5000;

int a[N];

int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n;
	cin >> n;
	int sum = 0;
	bitset<N> ddp;
	ddp[0] = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
		ddp |= (ddp << a[i]);
	}
	if (sum%2 == 1 || !ddp[sum/2]) {
		cout << "0\n";
		return 0;
	}
	vector<int> v;
	for (int i = 1; i <= sum; i++) {
		bool ok = true;
		for (int p = 0; p < n; p++) {
			bitset<N> dp;
			dp[0] = 1;
			int ss = 0;
			for (int j = 0; j < n; j++) {
				if (p == j) continue;
				dp |= (dp << a[j]);
				ss += a[j];
			}
			if ((ss+i)%2 == 1) {
				ok = false;
				break;
			}
			if (!dp[(ss+i)/2]) {
				ok = false;
				break;
			}
		}
		cerr << '\n';
		if (ok) v.push_back(i);
	}
	cout << v.size() << '\n';
	for (int i : v) cout << i << ' ';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 15 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 14 ms 456 KB Output is correct
15 Correct 13 ms 348 KB Output is correct
16 Correct 15 ms 460 KB Output is correct
17 Correct 5 ms 348 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 8 ms 460 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 15 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 14 ms 456 KB Output is correct
15 Correct 13 ms 348 KB Output is correct
16 Correct 15 ms 460 KB Output is correct
17 Correct 5 ms 348 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 8 ms 460 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 822 ms 440 KB Output is correct
22 Execution timed out 1051 ms 444 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 15 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 14 ms 456 KB Output is correct
15 Correct 13 ms 348 KB Output is correct
16 Correct 15 ms 460 KB Output is correct
17 Correct 5 ms 348 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 8 ms 460 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 822 ms 440 KB Output is correct
22 Execution timed out 1051 ms 444 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 15 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 14 ms 456 KB Output is correct
15 Correct 13 ms 348 KB Output is correct
16 Correct 15 ms 460 KB Output is correct
17 Correct 5 ms 348 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 8 ms 460 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 822 ms 440 KB Output is correct
22 Execution timed out 1051 ms 444 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 7 ms 464 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 15 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 14 ms 456 KB Output is correct
15 Correct 13 ms 348 KB Output is correct
16 Correct 15 ms 460 KB Output is correct
17 Correct 5 ms 348 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 8 ms 460 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 822 ms 440 KB Output is correct
22 Execution timed out 1051 ms 444 KB Time limit exceeded
23 Halted 0 ms 0 KB -