답안 #37428

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37428 2017-12-25T12:26:23 Z HardNut Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 3024 KB
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<bitset>

using namespace std;

const int N = 1e5 + 5;

typedef long long ll;

int n, a[505], sum;
vector<int> vec;
bitset<250005> b;
int ans[250005];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    if (sum % 2 == 1) {
        cout << 0;
        return 0;
    }
    for (int i = 1; i <= sum; i++) {
        ans[i] = 1;
    }
    for (int i = 0; i <= n; i++) {
        b.reset();
        b[0] = 1;
        for (int j = 1; j <= n; j++) {
            if (i != j)
                b |= (b << a[j]);
        }
        if (i == 0) {
            if (!b[sum / 2]) {
                cout << 0;
                return 0;
            }
            continue;
        }
        for (int j = 1; j <= sum; j++) {
            if ((sum + j - a[i]) % 2) {
                ans[j] = 0;
                continue;
            }
            if (!b[(sum + j - a[i]) / 2]) {
                ans[j] = 0;
            }
        }
    }
    int cnt = 0;
    for (int i = 1; i <= sum; i++) {
        cnt += ans[i];
    }
    cout << cnt << "\n";
    for (int i = 1; i <= sum; i++)
        if (ans[i])
            cout << i << " ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
10 Correct 13 ms 3024 KB Output is correct
11 Correct 13 ms 3024 KB Output is correct
12 Correct 13 ms 3024 KB Output is correct
13 Correct 16 ms 3024 KB Output is correct
14 Correct 9 ms 3024 KB Output is correct
15 Correct 9 ms 3024 KB Output is correct
16 Correct 23 ms 3024 KB Output is correct
17 Correct 6 ms 3024 KB Output is correct
18 Correct 9 ms 3024 KB Output is correct
19 Correct 9 ms 3024 KB Output is correct
20 Correct 16 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
10 Correct 13 ms 3024 KB Output is correct
11 Correct 13 ms 3024 KB Output is correct
12 Correct 13 ms 3024 KB Output is correct
13 Correct 16 ms 3024 KB Output is correct
14 Correct 9 ms 3024 KB Output is correct
15 Correct 9 ms 3024 KB Output is correct
16 Correct 23 ms 3024 KB Output is correct
17 Correct 6 ms 3024 KB Output is correct
18 Correct 9 ms 3024 KB Output is correct
19 Correct 9 ms 3024 KB Output is correct
20 Correct 16 ms 3024 KB Output is correct
21 Correct 59 ms 3024 KB Output is correct
22 Correct 89 ms 3024 KB Output is correct
23 Correct 36 ms 3024 KB Output is correct
24 Correct 126 ms 3024 KB Output is correct
25 Correct 129 ms 3024 KB Output is correct
26 Correct 143 ms 3024 KB Output is correct
27 Correct 139 ms 3024 KB Output is correct
28 Correct 143 ms 3024 KB Output is correct
29 Correct 139 ms 3024 KB Output is correct
30 Correct 143 ms 3024 KB Output is correct
31 Correct 149 ms 3024 KB Output is correct
32 Correct 139 ms 3024 KB Output is correct
33 Correct 143 ms 3024 KB Output is correct
34 Correct 139 ms 3024 KB Output is correct
35 Correct 143 ms 3024 KB Output is correct
36 Correct 153 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
10 Correct 13 ms 3024 KB Output is correct
11 Correct 13 ms 3024 KB Output is correct
12 Correct 13 ms 3024 KB Output is correct
13 Correct 16 ms 3024 KB Output is correct
14 Correct 9 ms 3024 KB Output is correct
15 Correct 9 ms 3024 KB Output is correct
16 Correct 23 ms 3024 KB Output is correct
17 Correct 6 ms 3024 KB Output is correct
18 Correct 9 ms 3024 KB Output is correct
19 Correct 9 ms 3024 KB Output is correct
20 Correct 16 ms 3024 KB Output is correct
21 Correct 59 ms 3024 KB Output is correct
22 Correct 89 ms 3024 KB Output is correct
23 Correct 36 ms 3024 KB Output is correct
24 Correct 126 ms 3024 KB Output is correct
25 Correct 129 ms 3024 KB Output is correct
26 Correct 143 ms 3024 KB Output is correct
27 Correct 139 ms 3024 KB Output is correct
28 Correct 143 ms 3024 KB Output is correct
29 Correct 139 ms 3024 KB Output is correct
30 Correct 143 ms 3024 KB Output is correct
31 Correct 149 ms 3024 KB Output is correct
32 Correct 139 ms 3024 KB Output is correct
33 Correct 143 ms 3024 KB Output is correct
34 Correct 139 ms 3024 KB Output is correct
35 Correct 143 ms 3024 KB Output is correct
36 Correct 153 ms 3024 KB Output is correct
37 Correct 639 ms 3024 KB Output is correct
38 Correct 613 ms 3024 KB Output is correct
39 Correct 936 ms 3024 KB Output is correct
40 Execution timed out 1000 ms 3024 KB Execution timed out
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
10 Correct 13 ms 3024 KB Output is correct
11 Correct 13 ms 3024 KB Output is correct
12 Correct 13 ms 3024 KB Output is correct
13 Correct 16 ms 3024 KB Output is correct
14 Correct 9 ms 3024 KB Output is correct
15 Correct 9 ms 3024 KB Output is correct
16 Correct 23 ms 3024 KB Output is correct
17 Correct 6 ms 3024 KB Output is correct
18 Correct 9 ms 3024 KB Output is correct
19 Correct 9 ms 3024 KB Output is correct
20 Correct 16 ms 3024 KB Output is correct
21 Correct 59 ms 3024 KB Output is correct
22 Correct 89 ms 3024 KB Output is correct
23 Correct 36 ms 3024 KB Output is correct
24 Correct 126 ms 3024 KB Output is correct
25 Correct 129 ms 3024 KB Output is correct
26 Correct 143 ms 3024 KB Output is correct
27 Correct 139 ms 3024 KB Output is correct
28 Correct 143 ms 3024 KB Output is correct
29 Correct 139 ms 3024 KB Output is correct
30 Correct 143 ms 3024 KB Output is correct
31 Correct 149 ms 3024 KB Output is correct
32 Correct 139 ms 3024 KB Output is correct
33 Correct 143 ms 3024 KB Output is correct
34 Correct 139 ms 3024 KB Output is correct
35 Correct 143 ms 3024 KB Output is correct
36 Correct 153 ms 3024 KB Output is correct
37 Correct 639 ms 3024 KB Output is correct
38 Correct 613 ms 3024 KB Output is correct
39 Correct 936 ms 3024 KB Output is correct
40 Execution timed out 1000 ms 3024 KB Execution timed out
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3024 KB Output is correct
2 Correct 0 ms 3024 KB Output is correct
3 Correct 0 ms 3024 KB Output is correct
4 Correct 0 ms 3024 KB Output is correct
5 Correct 0 ms 3024 KB Output is correct
6 Correct 0 ms 3024 KB Output is correct
7 Correct 0 ms 3024 KB Output is correct
8 Correct 3 ms 3024 KB Output is correct
9 Correct 0 ms 3024 KB Output is correct
10 Correct 13 ms 3024 KB Output is correct
11 Correct 13 ms 3024 KB Output is correct
12 Correct 13 ms 3024 KB Output is correct
13 Correct 16 ms 3024 KB Output is correct
14 Correct 9 ms 3024 KB Output is correct
15 Correct 9 ms 3024 KB Output is correct
16 Correct 23 ms 3024 KB Output is correct
17 Correct 6 ms 3024 KB Output is correct
18 Correct 9 ms 3024 KB Output is correct
19 Correct 9 ms 3024 KB Output is correct
20 Correct 16 ms 3024 KB Output is correct
21 Correct 59 ms 3024 KB Output is correct
22 Correct 89 ms 3024 KB Output is correct
23 Correct 36 ms 3024 KB Output is correct
24 Correct 126 ms 3024 KB Output is correct
25 Correct 129 ms 3024 KB Output is correct
26 Correct 143 ms 3024 KB Output is correct
27 Correct 139 ms 3024 KB Output is correct
28 Correct 143 ms 3024 KB Output is correct
29 Correct 139 ms 3024 KB Output is correct
30 Correct 143 ms 3024 KB Output is correct
31 Correct 149 ms 3024 KB Output is correct
32 Correct 139 ms 3024 KB Output is correct
33 Correct 143 ms 3024 KB Output is correct
34 Correct 139 ms 3024 KB Output is correct
35 Correct 143 ms 3024 KB Output is correct
36 Correct 153 ms 3024 KB Output is correct
37 Correct 639 ms 3024 KB Output is correct
38 Correct 613 ms 3024 KB Output is correct
39 Correct 936 ms 3024 KB Output is correct
40 Execution timed out 1000 ms 3024 KB Execution timed out
41 Halted 0 ms 0 KB -