답안 #894573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
894573 2023-12-28T13:02:32 Z Andrey Bootfall (IZhO17_bootfall) C++14
65 / 100
1000 ms 17840 KB
#include <bits/stdc++.h>
using namespace std;

bitset<501> idk[260001];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,sb = 0;
    cin >> n;
    vector<int> haha(n);
    for(int i = 0; i < n; i++) {
        cin >> haha[i];
        sb+=haha[i];
    }
    for(int i = 0; i < 501; i++) {
        idk[0][i] = 1;
    }
    for(int i = 0; i < n; i++) {
        for(int j = 260000; j >= haha[i]; j--) {
            bool a = idk[j][i];
            idk[j]|=idk[j-haha[i]];
            idk[j][i] = a;
        }
    }
    vector<int> ans(0);
    for(int i = 1; i <= 250000; i++) {
        bool yeah = true;
        if(sb%2 == 0) {
            if(idk[sb/2][n] == 0) {
                yeah = false;
            }
            for(int j = 0; j < n; j++) {
                if((sb+i-haha[j])%2 == 1) {
                    yeah = false;
                }
                if((sb+i-haha[j])/2 > 250000 || idk[(sb+i-haha[j])/2][j] == 0) {
                    yeah = false;
                }
            }
            if(yeah) {
                ans.push_back(i);
            }
        }
    }
    cout << ans.size() << "\n";
    for(int i = 0; i < ans.size(); i++) {
        cout << ans[i] << " ";
    }
    return 0;
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(int i = 0; i < ans.size(); i++) {
      |                    ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
10 Correct 67 ms 16732 KB Output is correct
11 Correct 62 ms 16724 KB Output is correct
12 Correct 63 ms 16728 KB Output is correct
13 Correct 71 ms 16476 KB Output is correct
14 Correct 55 ms 16728 KB Output is correct
15 Correct 65 ms 16976 KB Output is correct
16 Correct 60 ms 16728 KB Output is correct
17 Correct 47 ms 16732 KB Output is correct
18 Correct 58 ms 16708 KB Output is correct
19 Correct 52 ms 16732 KB Output is correct
20 Correct 62 ms 16732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
10 Correct 67 ms 16732 KB Output is correct
11 Correct 62 ms 16724 KB Output is correct
12 Correct 63 ms 16728 KB Output is correct
13 Correct 71 ms 16476 KB Output is correct
14 Correct 55 ms 16728 KB Output is correct
15 Correct 65 ms 16976 KB Output is correct
16 Correct 60 ms 16728 KB Output is correct
17 Correct 47 ms 16732 KB Output is correct
18 Correct 58 ms 16708 KB Output is correct
19 Correct 52 ms 16732 KB Output is correct
20 Correct 62 ms 16732 KB Output is correct
21 Correct 119 ms 16724 KB Output is correct
22 Correct 138 ms 16732 KB Output is correct
23 Correct 94 ms 16728 KB Output is correct
24 Correct 183 ms 16716 KB Output is correct
25 Correct 193 ms 16732 KB Output is correct
26 Correct 186 ms 16756 KB Output is correct
27 Correct 221 ms 16732 KB Output is correct
28 Correct 201 ms 16724 KB Output is correct
29 Correct 188 ms 16728 KB Output is correct
30 Correct 216 ms 16732 KB Output is correct
31 Correct 196 ms 16728 KB Output is correct
32 Correct 189 ms 16728 KB Output is correct
33 Correct 191 ms 16708 KB Output is correct
34 Correct 206 ms 16708 KB Output is correct
35 Correct 194 ms 16708 KB Output is correct
36 Correct 183 ms 16720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
10 Correct 67 ms 16732 KB Output is correct
11 Correct 62 ms 16724 KB Output is correct
12 Correct 63 ms 16728 KB Output is correct
13 Correct 71 ms 16476 KB Output is correct
14 Correct 55 ms 16728 KB Output is correct
15 Correct 65 ms 16976 KB Output is correct
16 Correct 60 ms 16728 KB Output is correct
17 Correct 47 ms 16732 KB Output is correct
18 Correct 58 ms 16708 KB Output is correct
19 Correct 52 ms 16732 KB Output is correct
20 Correct 62 ms 16732 KB Output is correct
21 Correct 119 ms 16724 KB Output is correct
22 Correct 138 ms 16732 KB Output is correct
23 Correct 94 ms 16728 KB Output is correct
24 Correct 183 ms 16716 KB Output is correct
25 Correct 193 ms 16732 KB Output is correct
26 Correct 186 ms 16756 KB Output is correct
27 Correct 221 ms 16732 KB Output is correct
28 Correct 201 ms 16724 KB Output is correct
29 Correct 188 ms 16728 KB Output is correct
30 Correct 216 ms 16732 KB Output is correct
31 Correct 196 ms 16728 KB Output is correct
32 Correct 189 ms 16728 KB Output is correct
33 Correct 191 ms 16708 KB Output is correct
34 Correct 206 ms 16708 KB Output is correct
35 Correct 194 ms 16708 KB Output is correct
36 Correct 183 ms 16720 KB Output is correct
37 Correct 379 ms 16728 KB Output is correct
38 Correct 382 ms 16988 KB Output is correct
39 Correct 458 ms 16476 KB Output is correct
40 Correct 504 ms 16728 KB Output is correct
41 Correct 506 ms 16708 KB Output is correct
42 Correct 443 ms 16732 KB Output is correct
43 Correct 440 ms 17092 KB Output is correct
44 Correct 463 ms 16976 KB Output is correct
45 Correct 485 ms 16940 KB Output is correct
46 Correct 520 ms 16976 KB Output is correct
47 Correct 480 ms 16732 KB Output is correct
48 Correct 466 ms 17012 KB Output is correct
49 Correct 498 ms 16708 KB Output is correct
50 Correct 505 ms 16732 KB Output is correct
51 Correct 349 ms 16728 KB Output is correct
52 Correct 526 ms 16972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
10 Correct 67 ms 16732 KB Output is correct
11 Correct 62 ms 16724 KB Output is correct
12 Correct 63 ms 16728 KB Output is correct
13 Correct 71 ms 16476 KB Output is correct
14 Correct 55 ms 16728 KB Output is correct
15 Correct 65 ms 16976 KB Output is correct
16 Correct 60 ms 16728 KB Output is correct
17 Correct 47 ms 16732 KB Output is correct
18 Correct 58 ms 16708 KB Output is correct
19 Correct 52 ms 16732 KB Output is correct
20 Correct 62 ms 16732 KB Output is correct
21 Correct 119 ms 16724 KB Output is correct
22 Correct 138 ms 16732 KB Output is correct
23 Correct 94 ms 16728 KB Output is correct
24 Correct 183 ms 16716 KB Output is correct
25 Correct 193 ms 16732 KB Output is correct
26 Correct 186 ms 16756 KB Output is correct
27 Correct 221 ms 16732 KB Output is correct
28 Correct 201 ms 16724 KB Output is correct
29 Correct 188 ms 16728 KB Output is correct
30 Correct 216 ms 16732 KB Output is correct
31 Correct 196 ms 16728 KB Output is correct
32 Correct 189 ms 16728 KB Output is correct
33 Correct 191 ms 16708 KB Output is correct
34 Correct 206 ms 16708 KB Output is correct
35 Correct 194 ms 16708 KB Output is correct
36 Correct 183 ms 16720 KB Output is correct
37 Correct 379 ms 16728 KB Output is correct
38 Correct 382 ms 16988 KB Output is correct
39 Correct 458 ms 16476 KB Output is correct
40 Correct 504 ms 16728 KB Output is correct
41 Correct 506 ms 16708 KB Output is correct
42 Correct 443 ms 16732 KB Output is correct
43 Correct 440 ms 17092 KB Output is correct
44 Correct 463 ms 16976 KB Output is correct
45 Correct 485 ms 16940 KB Output is correct
46 Correct 520 ms 16976 KB Output is correct
47 Correct 480 ms 16732 KB Output is correct
48 Correct 466 ms 17012 KB Output is correct
49 Correct 498 ms 16708 KB Output is correct
50 Correct 505 ms 16732 KB Output is correct
51 Correct 349 ms 16728 KB Output is correct
52 Correct 526 ms 16972 KB Output is correct
53 Correct 557 ms 16996 KB Output is correct
54 Correct 698 ms 16972 KB Output is correct
55 Correct 690 ms 17368 KB Output is correct
56 Correct 557 ms 16976 KB Output is correct
57 Correct 701 ms 17316 KB Output is correct
58 Correct 650 ms 16968 KB Output is correct
59 Correct 672 ms 17108 KB Output is correct
60 Correct 499 ms 16728 KB Output is correct
61 Correct 646 ms 17100 KB Output is correct
62 Correct 646 ms 17092 KB Output is correct
63 Correct 638 ms 17296 KB Output is correct
64 Correct 617 ms 17316 KB Output is correct
65 Correct 625 ms 16728 KB Output is correct
66 Correct 549 ms 16728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 16732 KB Output is correct
2 Correct 17 ms 16732 KB Output is correct
3 Correct 12 ms 16732 KB Output is correct
4 Correct 16 ms 16476 KB Output is correct
5 Correct 29 ms 16732 KB Output is correct
6 Correct 20 ms 16728 KB Output is correct
7 Correct 17 ms 16732 KB Output is correct
8 Correct 27 ms 16476 KB Output is correct
9 Correct 24 ms 16732 KB Output is correct
10 Correct 67 ms 16732 KB Output is correct
11 Correct 62 ms 16724 KB Output is correct
12 Correct 63 ms 16728 KB Output is correct
13 Correct 71 ms 16476 KB Output is correct
14 Correct 55 ms 16728 KB Output is correct
15 Correct 65 ms 16976 KB Output is correct
16 Correct 60 ms 16728 KB Output is correct
17 Correct 47 ms 16732 KB Output is correct
18 Correct 58 ms 16708 KB Output is correct
19 Correct 52 ms 16732 KB Output is correct
20 Correct 62 ms 16732 KB Output is correct
21 Correct 119 ms 16724 KB Output is correct
22 Correct 138 ms 16732 KB Output is correct
23 Correct 94 ms 16728 KB Output is correct
24 Correct 183 ms 16716 KB Output is correct
25 Correct 193 ms 16732 KB Output is correct
26 Correct 186 ms 16756 KB Output is correct
27 Correct 221 ms 16732 KB Output is correct
28 Correct 201 ms 16724 KB Output is correct
29 Correct 188 ms 16728 KB Output is correct
30 Correct 216 ms 16732 KB Output is correct
31 Correct 196 ms 16728 KB Output is correct
32 Correct 189 ms 16728 KB Output is correct
33 Correct 191 ms 16708 KB Output is correct
34 Correct 206 ms 16708 KB Output is correct
35 Correct 194 ms 16708 KB Output is correct
36 Correct 183 ms 16720 KB Output is correct
37 Correct 379 ms 16728 KB Output is correct
38 Correct 382 ms 16988 KB Output is correct
39 Correct 458 ms 16476 KB Output is correct
40 Correct 504 ms 16728 KB Output is correct
41 Correct 506 ms 16708 KB Output is correct
42 Correct 443 ms 16732 KB Output is correct
43 Correct 440 ms 17092 KB Output is correct
44 Correct 463 ms 16976 KB Output is correct
45 Correct 485 ms 16940 KB Output is correct
46 Correct 520 ms 16976 KB Output is correct
47 Correct 480 ms 16732 KB Output is correct
48 Correct 466 ms 17012 KB Output is correct
49 Correct 498 ms 16708 KB Output is correct
50 Correct 505 ms 16732 KB Output is correct
51 Correct 349 ms 16728 KB Output is correct
52 Correct 526 ms 16972 KB Output is correct
53 Correct 557 ms 16996 KB Output is correct
54 Correct 698 ms 16972 KB Output is correct
55 Correct 690 ms 17368 KB Output is correct
56 Correct 557 ms 16976 KB Output is correct
57 Correct 701 ms 17316 KB Output is correct
58 Correct 650 ms 16968 KB Output is correct
59 Correct 672 ms 17108 KB Output is correct
60 Correct 499 ms 16728 KB Output is correct
61 Correct 646 ms 17100 KB Output is correct
62 Correct 646 ms 17092 KB Output is correct
63 Correct 638 ms 17296 KB Output is correct
64 Correct 617 ms 17316 KB Output is correct
65 Correct 625 ms 16728 KB Output is correct
66 Correct 549 ms 16728 KB Output is correct
67 Correct 737 ms 17108 KB Output is correct
68 Correct 917 ms 16732 KB Output is correct
69 Execution timed out 1022 ms 17840 KB Time limit exceeded
70 Halted 0 ms 0 KB -