Submission #894574

# Submission time Handle Problem Language Result Execution time Memory
894574 2023-12-28T13:04:07 Z Andrey Bootfall (IZhO17_bootfall) C++14
100 / 100
936 ms 17348 KB
#include <bits/stdc++.h>
#pragma GCC target("popcnt")
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 = 250000; 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:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for(int i = 0; i < ans.size(); i++) {
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
10 Correct 78 ms 16092 KB Output is correct
11 Correct 69 ms 16088 KB Output is correct
12 Correct 68 ms 16088 KB Output is correct
13 Correct 65 ms 16092 KB Output is correct
14 Correct 66 ms 15964 KB Output is correct
15 Correct 65 ms 15964 KB Output is correct
16 Correct 63 ms 15964 KB Output is correct
17 Correct 45 ms 16088 KB Output is correct
18 Correct 58 ms 15964 KB Output is correct
19 Correct 51 ms 15960 KB Output is correct
20 Correct 69 ms 16092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
10 Correct 78 ms 16092 KB Output is correct
11 Correct 69 ms 16088 KB Output is correct
12 Correct 68 ms 16088 KB Output is correct
13 Correct 65 ms 16092 KB Output is correct
14 Correct 66 ms 15964 KB Output is correct
15 Correct 65 ms 15964 KB Output is correct
16 Correct 63 ms 15964 KB Output is correct
17 Correct 45 ms 16088 KB Output is correct
18 Correct 58 ms 15964 KB Output is correct
19 Correct 51 ms 15960 KB Output is correct
20 Correct 69 ms 16092 KB Output is correct
21 Correct 132 ms 16092 KB Output is correct
22 Correct 166 ms 16108 KB Output is correct
23 Correct 108 ms 16088 KB Output is correct
24 Correct 185 ms 16088 KB Output is correct
25 Correct 189 ms 15964 KB Output is correct
26 Correct 221 ms 15964 KB Output is correct
27 Correct 206 ms 15964 KB Output is correct
28 Correct 185 ms 15960 KB Output is correct
29 Correct 235 ms 15964 KB Output is correct
30 Correct 197 ms 15960 KB Output is correct
31 Correct 175 ms 16216 KB Output is correct
32 Correct 182 ms 16096 KB Output is correct
33 Correct 184 ms 15964 KB Output is correct
34 Correct 181 ms 16120 KB Output is correct
35 Correct 224 ms 15964 KB Output is correct
36 Correct 176 ms 15960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
10 Correct 78 ms 16092 KB Output is correct
11 Correct 69 ms 16088 KB Output is correct
12 Correct 68 ms 16088 KB Output is correct
13 Correct 65 ms 16092 KB Output is correct
14 Correct 66 ms 15964 KB Output is correct
15 Correct 65 ms 15964 KB Output is correct
16 Correct 63 ms 15964 KB Output is correct
17 Correct 45 ms 16088 KB Output is correct
18 Correct 58 ms 15964 KB Output is correct
19 Correct 51 ms 15960 KB Output is correct
20 Correct 69 ms 16092 KB Output is correct
21 Correct 132 ms 16092 KB Output is correct
22 Correct 166 ms 16108 KB Output is correct
23 Correct 108 ms 16088 KB Output is correct
24 Correct 185 ms 16088 KB Output is correct
25 Correct 189 ms 15964 KB Output is correct
26 Correct 221 ms 15964 KB Output is correct
27 Correct 206 ms 15964 KB Output is correct
28 Correct 185 ms 15960 KB Output is correct
29 Correct 235 ms 15964 KB Output is correct
30 Correct 197 ms 15960 KB Output is correct
31 Correct 175 ms 16216 KB Output is correct
32 Correct 182 ms 16096 KB Output is correct
33 Correct 184 ms 15964 KB Output is correct
34 Correct 181 ms 16120 KB Output is correct
35 Correct 224 ms 15964 KB Output is correct
36 Correct 176 ms 15960 KB Output is correct
37 Correct 357 ms 16152 KB Output is correct
38 Correct 355 ms 16212 KB Output is correct
39 Correct 472 ms 16084 KB Output is correct
40 Correct 483 ms 16212 KB Output is correct
41 Correct 487 ms 15964 KB Output is correct
42 Correct 451 ms 16240 KB Output is correct
43 Correct 430 ms 16212 KB Output is correct
44 Correct 470 ms 16352 KB Output is correct
45 Correct 464 ms 16468 KB Output is correct
46 Correct 486 ms 16212 KB Output is correct
47 Correct 443 ms 16212 KB Output is correct
48 Correct 460 ms 16332 KB Output is correct
49 Correct 435 ms 16096 KB Output is correct
50 Correct 426 ms 16212 KB Output is correct
51 Correct 345 ms 15964 KB Output is correct
52 Correct 476 ms 16468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
10 Correct 78 ms 16092 KB Output is correct
11 Correct 69 ms 16088 KB Output is correct
12 Correct 68 ms 16088 KB Output is correct
13 Correct 65 ms 16092 KB Output is correct
14 Correct 66 ms 15964 KB Output is correct
15 Correct 65 ms 15964 KB Output is correct
16 Correct 63 ms 15964 KB Output is correct
17 Correct 45 ms 16088 KB Output is correct
18 Correct 58 ms 15964 KB Output is correct
19 Correct 51 ms 15960 KB Output is correct
20 Correct 69 ms 16092 KB Output is correct
21 Correct 132 ms 16092 KB Output is correct
22 Correct 166 ms 16108 KB Output is correct
23 Correct 108 ms 16088 KB Output is correct
24 Correct 185 ms 16088 KB Output is correct
25 Correct 189 ms 15964 KB Output is correct
26 Correct 221 ms 15964 KB Output is correct
27 Correct 206 ms 15964 KB Output is correct
28 Correct 185 ms 15960 KB Output is correct
29 Correct 235 ms 15964 KB Output is correct
30 Correct 197 ms 15960 KB Output is correct
31 Correct 175 ms 16216 KB Output is correct
32 Correct 182 ms 16096 KB Output is correct
33 Correct 184 ms 15964 KB Output is correct
34 Correct 181 ms 16120 KB Output is correct
35 Correct 224 ms 15964 KB Output is correct
36 Correct 176 ms 15960 KB Output is correct
37 Correct 357 ms 16152 KB Output is correct
38 Correct 355 ms 16212 KB Output is correct
39 Correct 472 ms 16084 KB Output is correct
40 Correct 483 ms 16212 KB Output is correct
41 Correct 487 ms 15964 KB Output is correct
42 Correct 451 ms 16240 KB Output is correct
43 Correct 430 ms 16212 KB Output is correct
44 Correct 470 ms 16352 KB Output is correct
45 Correct 464 ms 16468 KB Output is correct
46 Correct 486 ms 16212 KB Output is correct
47 Correct 443 ms 16212 KB Output is correct
48 Correct 460 ms 16332 KB Output is correct
49 Correct 435 ms 16096 KB Output is correct
50 Correct 426 ms 16212 KB Output is correct
51 Correct 345 ms 15964 KB Output is correct
52 Correct 476 ms 16468 KB Output is correct
53 Correct 520 ms 16308 KB Output is correct
54 Correct 633 ms 16468 KB Output is correct
55 Correct 635 ms 16944 KB Output is correct
56 Correct 559 ms 16356 KB Output is correct
57 Correct 610 ms 16720 KB Output is correct
58 Correct 637 ms 16348 KB Output is correct
59 Correct 643 ms 16480 KB Output is correct
60 Correct 455 ms 15964 KB Output is correct
61 Correct 635 ms 16596 KB Output is correct
62 Correct 590 ms 16468 KB Output is correct
63 Correct 552 ms 16852 KB Output is correct
64 Correct 539 ms 16664 KB Output is correct
65 Correct 549 ms 16100 KB Output is correct
66 Correct 562 ms 16212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 15960 KB Output is correct
2 Correct 17 ms 15964 KB Output is correct
3 Correct 12 ms 15964 KB Output is correct
4 Correct 14 ms 16104 KB Output is correct
5 Correct 30 ms 15964 KB Output is correct
6 Correct 25 ms 15964 KB Output is correct
7 Correct 18 ms 15964 KB Output is correct
8 Correct 30 ms 15964 KB Output is correct
9 Correct 27 ms 16120 KB Output is correct
10 Correct 78 ms 16092 KB Output is correct
11 Correct 69 ms 16088 KB Output is correct
12 Correct 68 ms 16088 KB Output is correct
13 Correct 65 ms 16092 KB Output is correct
14 Correct 66 ms 15964 KB Output is correct
15 Correct 65 ms 15964 KB Output is correct
16 Correct 63 ms 15964 KB Output is correct
17 Correct 45 ms 16088 KB Output is correct
18 Correct 58 ms 15964 KB Output is correct
19 Correct 51 ms 15960 KB Output is correct
20 Correct 69 ms 16092 KB Output is correct
21 Correct 132 ms 16092 KB Output is correct
22 Correct 166 ms 16108 KB Output is correct
23 Correct 108 ms 16088 KB Output is correct
24 Correct 185 ms 16088 KB Output is correct
25 Correct 189 ms 15964 KB Output is correct
26 Correct 221 ms 15964 KB Output is correct
27 Correct 206 ms 15964 KB Output is correct
28 Correct 185 ms 15960 KB Output is correct
29 Correct 235 ms 15964 KB Output is correct
30 Correct 197 ms 15960 KB Output is correct
31 Correct 175 ms 16216 KB Output is correct
32 Correct 182 ms 16096 KB Output is correct
33 Correct 184 ms 15964 KB Output is correct
34 Correct 181 ms 16120 KB Output is correct
35 Correct 224 ms 15964 KB Output is correct
36 Correct 176 ms 15960 KB Output is correct
37 Correct 357 ms 16152 KB Output is correct
38 Correct 355 ms 16212 KB Output is correct
39 Correct 472 ms 16084 KB Output is correct
40 Correct 483 ms 16212 KB Output is correct
41 Correct 487 ms 15964 KB Output is correct
42 Correct 451 ms 16240 KB Output is correct
43 Correct 430 ms 16212 KB Output is correct
44 Correct 470 ms 16352 KB Output is correct
45 Correct 464 ms 16468 KB Output is correct
46 Correct 486 ms 16212 KB Output is correct
47 Correct 443 ms 16212 KB Output is correct
48 Correct 460 ms 16332 KB Output is correct
49 Correct 435 ms 16096 KB Output is correct
50 Correct 426 ms 16212 KB Output is correct
51 Correct 345 ms 15964 KB Output is correct
52 Correct 476 ms 16468 KB Output is correct
53 Correct 520 ms 16308 KB Output is correct
54 Correct 633 ms 16468 KB Output is correct
55 Correct 635 ms 16944 KB Output is correct
56 Correct 559 ms 16356 KB Output is correct
57 Correct 610 ms 16720 KB Output is correct
58 Correct 637 ms 16348 KB Output is correct
59 Correct 643 ms 16480 KB Output is correct
60 Correct 455 ms 15964 KB Output is correct
61 Correct 635 ms 16596 KB Output is correct
62 Correct 590 ms 16468 KB Output is correct
63 Correct 552 ms 16852 KB Output is correct
64 Correct 539 ms 16664 KB Output is correct
65 Correct 549 ms 16100 KB Output is correct
66 Correct 562 ms 16212 KB Output is correct
67 Correct 725 ms 16592 KB Output is correct
68 Correct 869 ms 16092 KB Output is correct
69 Correct 885 ms 17244 KB Output is correct
70 Correct 936 ms 16996 KB Output is correct
71 Correct 860 ms 16788 KB Output is correct
72 Correct 897 ms 16112 KB Output is correct
73 Correct 889 ms 16092 KB Output is correct
74 Correct 881 ms 17348 KB Output is correct
75 Correct 928 ms 17100 KB Output is correct
76 Correct 904 ms 17204 KB Output is correct
77 Correct 866 ms 17232 KB Output is correct