답안 #37427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37427 2017-12-25T12:24:00 Z HardNut Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 3024 KB
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MX = 250100;

int n;
int a[600];
int fl[MX];

bitset<MX> bb;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	for (int i = 1; i < MX; ++i)
		fl[i] = 1;
	for (int i = -1; i < n; ++i) {
		int sum = 0;
		bb.reset();
		bb[0] = 1;
		for (int j = 0; j < n; ++j)
			if (i != j) {
				sum += a[j];
				bb |= (bb << a[j]);
			}
		if (i != -1) {
			for (int j = 1; j < MX; ++j) {
				if ((sum + j) % 2 == 1 || !bb[(sum + j) / 2])
					fl[j] = 0;
			}
		}
		else {
			if (sum % 2 == 1 || !bb[sum / 2]) {
				cout << 0 << "\n";
				return 0;
			}
		}
	}
	int cnt = 0;
	for (int i = 0; i < MX; ++i)
		cnt += fl[i];
	printf("%d\n", cnt);
	for (int i = 1; i < MX; ++i) {
		if (fl[i])
			cout << i << " ";
	}
	cout << "\n";
	return 0;
}


Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:32:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
bootfall.cpp:34:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", a + i);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
10 Correct 26 ms 3024 KB Output is correct
11 Correct 26 ms 3024 KB Output is correct
12 Correct 36 ms 3024 KB Output is correct
13 Correct 23 ms 3024 KB Output is correct
14 Correct 29 ms 3024 KB Output is correct
15 Correct 23 ms 3024 KB Output is correct
16 Correct 33 ms 3024 KB Output is correct
17 Correct 13 ms 3024 KB Output is correct
18 Correct 23 ms 3024 KB Output is correct
19 Correct 43 ms 3024 KB Output is correct
20 Correct 29 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
10 Correct 26 ms 3024 KB Output is correct
11 Correct 26 ms 3024 KB Output is correct
12 Correct 36 ms 3024 KB Output is correct
13 Correct 23 ms 3024 KB Output is correct
14 Correct 29 ms 3024 KB Output is correct
15 Correct 23 ms 3024 KB Output is correct
16 Correct 33 ms 3024 KB Output is correct
17 Correct 13 ms 3024 KB Output is correct
18 Correct 23 ms 3024 KB Output is correct
19 Correct 43 ms 3024 KB Output is correct
20 Correct 29 ms 3024 KB Output is correct
21 Correct 93 ms 3024 KB Output is correct
22 Correct 146 ms 3024 KB Output is correct
23 Correct 59 ms 3024 KB Output is correct
24 Correct 199 ms 3024 KB Output is correct
25 Correct 173 ms 3024 KB Output is correct
26 Correct 193 ms 3024 KB Output is correct
27 Correct 193 ms 3024 KB Output is correct
28 Correct 203 ms 3024 KB Output is correct
29 Correct 193 ms 3024 KB Output is correct
30 Correct 199 ms 3024 KB Output is correct
31 Correct 209 ms 3024 KB Output is correct
32 Correct 203 ms 3024 KB Output is correct
33 Correct 193 ms 3024 KB Output is correct
34 Correct 193 ms 3024 KB Output is correct
35 Correct 199 ms 3024 KB Output is correct
36 Correct 193 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
10 Correct 26 ms 3024 KB Output is correct
11 Correct 26 ms 3024 KB Output is correct
12 Correct 36 ms 3024 KB Output is correct
13 Correct 23 ms 3024 KB Output is correct
14 Correct 29 ms 3024 KB Output is correct
15 Correct 23 ms 3024 KB Output is correct
16 Correct 33 ms 3024 KB Output is correct
17 Correct 13 ms 3024 KB Output is correct
18 Correct 23 ms 3024 KB Output is correct
19 Correct 43 ms 3024 KB Output is correct
20 Correct 29 ms 3024 KB Output is correct
21 Correct 93 ms 3024 KB Output is correct
22 Correct 146 ms 3024 KB Output is correct
23 Correct 59 ms 3024 KB Output is correct
24 Correct 199 ms 3024 KB Output is correct
25 Correct 173 ms 3024 KB Output is correct
26 Correct 193 ms 3024 KB Output is correct
27 Correct 193 ms 3024 KB Output is correct
28 Correct 203 ms 3024 KB Output is correct
29 Correct 193 ms 3024 KB Output is correct
30 Correct 199 ms 3024 KB Output is correct
31 Correct 209 ms 3024 KB Output is correct
32 Correct 203 ms 3024 KB Output is correct
33 Correct 193 ms 3024 KB Output is correct
34 Correct 193 ms 3024 KB Output is correct
35 Correct 199 ms 3024 KB Output is correct
36 Correct 193 ms 3024 KB Output is correct
37 Correct 666 ms 3024 KB Output is correct
38 Correct 673 ms 3024 KB Output is correct
39 Execution timed out 1000 ms 3024 KB Execution timed out
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
10 Correct 26 ms 3024 KB Output is correct
11 Correct 26 ms 3024 KB Output is correct
12 Correct 36 ms 3024 KB Output is correct
13 Correct 23 ms 3024 KB Output is correct
14 Correct 29 ms 3024 KB Output is correct
15 Correct 23 ms 3024 KB Output is correct
16 Correct 33 ms 3024 KB Output is correct
17 Correct 13 ms 3024 KB Output is correct
18 Correct 23 ms 3024 KB Output is correct
19 Correct 43 ms 3024 KB Output is correct
20 Correct 29 ms 3024 KB Output is correct
21 Correct 93 ms 3024 KB Output is correct
22 Correct 146 ms 3024 KB Output is correct
23 Correct 59 ms 3024 KB Output is correct
24 Correct 199 ms 3024 KB Output is correct
25 Correct 173 ms 3024 KB Output is correct
26 Correct 193 ms 3024 KB Output is correct
27 Correct 193 ms 3024 KB Output is correct
28 Correct 203 ms 3024 KB Output is correct
29 Correct 193 ms 3024 KB Output is correct
30 Correct 199 ms 3024 KB Output is correct
31 Correct 209 ms 3024 KB Output is correct
32 Correct 203 ms 3024 KB Output is correct
33 Correct 193 ms 3024 KB Output is correct
34 Correct 193 ms 3024 KB Output is correct
35 Correct 199 ms 3024 KB Output is correct
36 Correct 193 ms 3024 KB Output is correct
37 Correct 666 ms 3024 KB Output is correct
38 Correct 673 ms 3024 KB Output is correct
39 Execution timed out 1000 ms 3024 KB Execution timed out
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3024 KB Output is correct
2 Correct 6 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 3 ms 3024 KB Output is correct
5 Correct 9 ms 3024 KB Output is correct
6 Correct 9 ms 3024 KB Output is correct
7 Correct 3 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 6 ms 3024 KB Output is correct
10 Correct 26 ms 3024 KB Output is correct
11 Correct 26 ms 3024 KB Output is correct
12 Correct 36 ms 3024 KB Output is correct
13 Correct 23 ms 3024 KB Output is correct
14 Correct 29 ms 3024 KB Output is correct
15 Correct 23 ms 3024 KB Output is correct
16 Correct 33 ms 3024 KB Output is correct
17 Correct 13 ms 3024 KB Output is correct
18 Correct 23 ms 3024 KB Output is correct
19 Correct 43 ms 3024 KB Output is correct
20 Correct 29 ms 3024 KB Output is correct
21 Correct 93 ms 3024 KB Output is correct
22 Correct 146 ms 3024 KB Output is correct
23 Correct 59 ms 3024 KB Output is correct
24 Correct 199 ms 3024 KB Output is correct
25 Correct 173 ms 3024 KB Output is correct
26 Correct 193 ms 3024 KB Output is correct
27 Correct 193 ms 3024 KB Output is correct
28 Correct 203 ms 3024 KB Output is correct
29 Correct 193 ms 3024 KB Output is correct
30 Correct 199 ms 3024 KB Output is correct
31 Correct 209 ms 3024 KB Output is correct
32 Correct 203 ms 3024 KB Output is correct
33 Correct 193 ms 3024 KB Output is correct
34 Correct 193 ms 3024 KB Output is correct
35 Correct 199 ms 3024 KB Output is correct
36 Correct 193 ms 3024 KB Output is correct
37 Correct 666 ms 3024 KB Output is correct
38 Correct 673 ms 3024 KB Output is correct
39 Execution timed out 1000 ms 3024 KB Execution timed out
40 Halted 0 ms 0 KB -