Submission #894566

# Submission time Handle Problem Language Result Execution time Memory
894566 2023-12-28T12:58:21 Z Andrey Bootfall (IZhO17_bootfall) C++14
28 / 100
37 ms 3924 KB
#include <bits/stdc++.h>
using namespace std;

bitset<501> idk[26001];

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 = 26000; 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 <= 25000; 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(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++) {
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
10 Correct 6 ms 1884 KB Output is correct
11 Correct 6 ms 2076 KB Output is correct
12 Correct 7 ms 1880 KB Output is correct
13 Correct 5 ms 1880 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 5 ms 1884 KB Output is correct
16 Correct 6 ms 1884 KB Output is correct
17 Correct 5 ms 1884 KB Output is correct
18 Correct 7 ms 1884 KB Output is correct
19 Correct 5 ms 1880 KB Output is correct
20 Correct 6 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
10 Correct 6 ms 1884 KB Output is correct
11 Correct 6 ms 2076 KB Output is correct
12 Correct 7 ms 1880 KB Output is correct
13 Correct 5 ms 1880 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 5 ms 1884 KB Output is correct
16 Correct 6 ms 1884 KB Output is correct
17 Correct 5 ms 1884 KB Output is correct
18 Correct 7 ms 1884 KB Output is correct
19 Correct 5 ms 1880 KB Output is correct
20 Correct 6 ms 1884 KB Output is correct
21 Correct 16 ms 1884 KB Output is correct
22 Correct 12 ms 1884 KB Output is correct
23 Correct 9 ms 1884 KB Output is correct
24 Correct 15 ms 2108 KB Output is correct
25 Correct 15 ms 1884 KB Output is correct
26 Correct 16 ms 1880 KB Output is correct
27 Correct 16 ms 2328 KB Output is correct
28 Correct 16 ms 1884 KB Output is correct
29 Correct 16 ms 2088 KB Output is correct
30 Correct 16 ms 1884 KB Output is correct
31 Correct 17 ms 1884 KB Output is correct
32 Correct 28 ms 1884 KB Output is correct
33 Correct 27 ms 2080 KB Output is correct
34 Correct 16 ms 2084 KB Output is correct
35 Correct 18 ms 1884 KB Output is correct
36 Correct 16 ms 2080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
10 Correct 6 ms 1884 KB Output is correct
11 Correct 6 ms 2076 KB Output is correct
12 Correct 7 ms 1880 KB Output is correct
13 Correct 5 ms 1880 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 5 ms 1884 KB Output is correct
16 Correct 6 ms 1884 KB Output is correct
17 Correct 5 ms 1884 KB Output is correct
18 Correct 7 ms 1884 KB Output is correct
19 Correct 5 ms 1880 KB Output is correct
20 Correct 6 ms 1884 KB Output is correct
21 Correct 16 ms 1884 KB Output is correct
22 Correct 12 ms 1884 KB Output is correct
23 Correct 9 ms 1884 KB Output is correct
24 Correct 15 ms 2108 KB Output is correct
25 Correct 15 ms 1884 KB Output is correct
26 Correct 16 ms 1880 KB Output is correct
27 Correct 16 ms 2328 KB Output is correct
28 Correct 16 ms 1884 KB Output is correct
29 Correct 16 ms 2088 KB Output is correct
30 Correct 16 ms 1884 KB Output is correct
31 Correct 17 ms 1884 KB Output is correct
32 Correct 28 ms 1884 KB Output is correct
33 Correct 27 ms 2080 KB Output is correct
34 Correct 16 ms 2084 KB Output is correct
35 Correct 18 ms 1884 KB Output is correct
36 Correct 16 ms 2080 KB Output is correct
37 Correct 32 ms 2056 KB Output is correct
38 Correct 37 ms 2336 KB Output is correct
39 Runtime error 29 ms 3924 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
10 Correct 6 ms 1884 KB Output is correct
11 Correct 6 ms 2076 KB Output is correct
12 Correct 7 ms 1880 KB Output is correct
13 Correct 5 ms 1880 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 5 ms 1884 KB Output is correct
16 Correct 6 ms 1884 KB Output is correct
17 Correct 5 ms 1884 KB Output is correct
18 Correct 7 ms 1884 KB Output is correct
19 Correct 5 ms 1880 KB Output is correct
20 Correct 6 ms 1884 KB Output is correct
21 Correct 16 ms 1884 KB Output is correct
22 Correct 12 ms 1884 KB Output is correct
23 Correct 9 ms 1884 KB Output is correct
24 Correct 15 ms 2108 KB Output is correct
25 Correct 15 ms 1884 KB Output is correct
26 Correct 16 ms 1880 KB Output is correct
27 Correct 16 ms 2328 KB Output is correct
28 Correct 16 ms 1884 KB Output is correct
29 Correct 16 ms 2088 KB Output is correct
30 Correct 16 ms 1884 KB Output is correct
31 Correct 17 ms 1884 KB Output is correct
32 Correct 28 ms 1884 KB Output is correct
33 Correct 27 ms 2080 KB Output is correct
34 Correct 16 ms 2084 KB Output is correct
35 Correct 18 ms 1884 KB Output is correct
36 Correct 16 ms 2080 KB Output is correct
37 Correct 32 ms 2056 KB Output is correct
38 Correct 37 ms 2336 KB Output is correct
39 Runtime error 29 ms 3924 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1884 KB Output is correct
2 Correct 2 ms 1884 KB Output is correct
3 Correct 1 ms 1884 KB Output is correct
4 Correct 2 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 2 ms 1884 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 3 ms 1880 KB Output is correct
10 Correct 6 ms 1884 KB Output is correct
11 Correct 6 ms 2076 KB Output is correct
12 Correct 7 ms 1880 KB Output is correct
13 Correct 5 ms 1880 KB Output is correct
14 Correct 5 ms 1884 KB Output is correct
15 Correct 5 ms 1884 KB Output is correct
16 Correct 6 ms 1884 KB Output is correct
17 Correct 5 ms 1884 KB Output is correct
18 Correct 7 ms 1884 KB Output is correct
19 Correct 5 ms 1880 KB Output is correct
20 Correct 6 ms 1884 KB Output is correct
21 Correct 16 ms 1884 KB Output is correct
22 Correct 12 ms 1884 KB Output is correct
23 Correct 9 ms 1884 KB Output is correct
24 Correct 15 ms 2108 KB Output is correct
25 Correct 15 ms 1884 KB Output is correct
26 Correct 16 ms 1880 KB Output is correct
27 Correct 16 ms 2328 KB Output is correct
28 Correct 16 ms 1884 KB Output is correct
29 Correct 16 ms 2088 KB Output is correct
30 Correct 16 ms 1884 KB Output is correct
31 Correct 17 ms 1884 KB Output is correct
32 Correct 28 ms 1884 KB Output is correct
33 Correct 27 ms 2080 KB Output is correct
34 Correct 16 ms 2084 KB Output is correct
35 Correct 18 ms 1884 KB Output is correct
36 Correct 16 ms 2080 KB Output is correct
37 Correct 32 ms 2056 KB Output is correct
38 Correct 37 ms 2336 KB Output is correct
39 Runtime error 29 ms 3924 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -