Submission #488282

# Submission time Handle Problem Language Result Execution time Memory
488282 2021-11-18T12:05:36 Z OttincaM Bootfall (IZhO17_bootfall) C++17
44 / 100
1000 ms 1480 KB
#include <bits/stdc++.h>
using namespace std;
int const maxn = 500*500 + 9;
bitset <maxn> b;
int a[505];
int cnt[maxn];
int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    b[0] = 1;
    long long sum = 0;
    for(int i = 0; i < n; i ++) {
        cin >> a[i];
        sum += a[i];
        b |= b << a[i];
    }
    if(sum & 1 || !b[sum / 2]) {
        return cout << 0, 0;
    }
    for(int i = 0; i < n; i ++) {
        b.reset();
        b[0] = 1;
        for(int j = 0; j < n; j ++)
            if(i != j) 
                b |= b << a[j];
        for(int j = 1; j < maxn; j ++) {
            int me = j + j - sum + a[i];
            if(b[j] && me > 0)
                cnt[me] ++;
        }
    }
    vector <int> v;
    for(int i = 1; i < maxn; i ++)
        if(cnt[i] == n)
            v.push_back(i);
    cout << v.size() << '\n';
    for(int i : v)
        cout << i << ' ';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 12 ms 404 KB Output is correct
11 Correct 14 ms 404 KB Output is correct
12 Correct 13 ms 332 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 11 ms 404 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 12 ms 332 KB Output is correct
17 Correct 9 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 10 ms 404 KB Output is correct
20 Correct 15 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 12 ms 404 KB Output is correct
11 Correct 14 ms 404 KB Output is correct
12 Correct 13 ms 332 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 11 ms 404 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 12 ms 332 KB Output is correct
17 Correct 9 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 10 ms 404 KB Output is correct
20 Correct 15 ms 400 KB Output is correct
21 Correct 42 ms 332 KB Output is correct
22 Correct 58 ms 396 KB Output is correct
23 Correct 28 ms 400 KB Output is correct
24 Correct 86 ms 400 KB Output is correct
25 Correct 82 ms 432 KB Output is correct
26 Correct 91 ms 436 KB Output is correct
27 Correct 91 ms 416 KB Output is correct
28 Correct 90 ms 420 KB Output is correct
29 Correct 91 ms 424 KB Output is correct
30 Correct 89 ms 400 KB Output is correct
31 Correct 99 ms 416 KB Output is correct
32 Correct 94 ms 400 KB Output is correct
33 Correct 88 ms 424 KB Output is correct
34 Correct 91 ms 424 KB Output is correct
35 Correct 89 ms 428 KB Output is correct
36 Correct 91 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 12 ms 404 KB Output is correct
11 Correct 14 ms 404 KB Output is correct
12 Correct 13 ms 332 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 11 ms 404 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 12 ms 332 KB Output is correct
17 Correct 9 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 10 ms 404 KB Output is correct
20 Correct 15 ms 400 KB Output is correct
21 Correct 42 ms 332 KB Output is correct
22 Correct 58 ms 396 KB Output is correct
23 Correct 28 ms 400 KB Output is correct
24 Correct 86 ms 400 KB Output is correct
25 Correct 82 ms 432 KB Output is correct
26 Correct 91 ms 436 KB Output is correct
27 Correct 91 ms 416 KB Output is correct
28 Correct 90 ms 420 KB Output is correct
29 Correct 91 ms 424 KB Output is correct
30 Correct 89 ms 400 KB Output is correct
31 Correct 99 ms 416 KB Output is correct
32 Correct 94 ms 400 KB Output is correct
33 Correct 88 ms 424 KB Output is correct
34 Correct 91 ms 424 KB Output is correct
35 Correct 89 ms 428 KB Output is correct
36 Correct 91 ms 400 KB Output is correct
37 Correct 326 ms 592 KB Output is correct
38 Correct 322 ms 588 KB Output is correct
39 Correct 490 ms 632 KB Output is correct
40 Correct 584 ms 640 KB Output is correct
41 Correct 569 ms 668 KB Output is correct
42 Correct 510 ms 624 KB Output is correct
43 Correct 482 ms 984 KB Output is correct
44 Correct 487 ms 988 KB Output is correct
45 Correct 496 ms 992 KB Output is correct
46 Correct 578 ms 504 KB Output is correct
47 Correct 497 ms 640 KB Output is correct
48 Correct 500 ms 880 KB Output is correct
49 Correct 495 ms 628 KB Output is correct
50 Correct 505 ms 652 KB Output is correct
51 Correct 2 ms 332 KB Output is correct
52 Correct 576 ms 1048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 12 ms 404 KB Output is correct
11 Correct 14 ms 404 KB Output is correct
12 Correct 13 ms 332 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 11 ms 404 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 12 ms 332 KB Output is correct
17 Correct 9 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 10 ms 404 KB Output is correct
20 Correct 15 ms 400 KB Output is correct
21 Correct 42 ms 332 KB Output is correct
22 Correct 58 ms 396 KB Output is correct
23 Correct 28 ms 400 KB Output is correct
24 Correct 86 ms 400 KB Output is correct
25 Correct 82 ms 432 KB Output is correct
26 Correct 91 ms 436 KB Output is correct
27 Correct 91 ms 416 KB Output is correct
28 Correct 90 ms 420 KB Output is correct
29 Correct 91 ms 424 KB Output is correct
30 Correct 89 ms 400 KB Output is correct
31 Correct 99 ms 416 KB Output is correct
32 Correct 94 ms 400 KB Output is correct
33 Correct 88 ms 424 KB Output is correct
34 Correct 91 ms 424 KB Output is correct
35 Correct 89 ms 428 KB Output is correct
36 Correct 91 ms 400 KB Output is correct
37 Correct 326 ms 592 KB Output is correct
38 Correct 322 ms 588 KB Output is correct
39 Correct 490 ms 632 KB Output is correct
40 Correct 584 ms 640 KB Output is correct
41 Correct 569 ms 668 KB Output is correct
42 Correct 510 ms 624 KB Output is correct
43 Correct 482 ms 984 KB Output is correct
44 Correct 487 ms 988 KB Output is correct
45 Correct 496 ms 992 KB Output is correct
46 Correct 578 ms 504 KB Output is correct
47 Correct 497 ms 640 KB Output is correct
48 Correct 500 ms 880 KB Output is correct
49 Correct 495 ms 628 KB Output is correct
50 Correct 505 ms 652 KB Output is correct
51 Correct 2 ms 332 KB Output is correct
52 Correct 576 ms 1048 KB Output is correct
53 Correct 703 ms 812 KB Output is correct
54 Correct 957 ms 984 KB Output is correct
55 Correct 954 ms 1336 KB Output is correct
56 Correct 722 ms 1092 KB Output is correct
57 Execution timed out 1002 ms 1480 KB Time limit exceeded
58 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 4 ms 332 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 12 ms 404 KB Output is correct
11 Correct 14 ms 404 KB Output is correct
12 Correct 13 ms 332 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 11 ms 404 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 12 ms 332 KB Output is correct
17 Correct 9 ms 332 KB Output is correct
18 Correct 9 ms 332 KB Output is correct
19 Correct 10 ms 404 KB Output is correct
20 Correct 15 ms 400 KB Output is correct
21 Correct 42 ms 332 KB Output is correct
22 Correct 58 ms 396 KB Output is correct
23 Correct 28 ms 400 KB Output is correct
24 Correct 86 ms 400 KB Output is correct
25 Correct 82 ms 432 KB Output is correct
26 Correct 91 ms 436 KB Output is correct
27 Correct 91 ms 416 KB Output is correct
28 Correct 90 ms 420 KB Output is correct
29 Correct 91 ms 424 KB Output is correct
30 Correct 89 ms 400 KB Output is correct
31 Correct 99 ms 416 KB Output is correct
32 Correct 94 ms 400 KB Output is correct
33 Correct 88 ms 424 KB Output is correct
34 Correct 91 ms 424 KB Output is correct
35 Correct 89 ms 428 KB Output is correct
36 Correct 91 ms 400 KB Output is correct
37 Correct 326 ms 592 KB Output is correct
38 Correct 322 ms 588 KB Output is correct
39 Correct 490 ms 632 KB Output is correct
40 Correct 584 ms 640 KB Output is correct
41 Correct 569 ms 668 KB Output is correct
42 Correct 510 ms 624 KB Output is correct
43 Correct 482 ms 984 KB Output is correct
44 Correct 487 ms 988 KB Output is correct
45 Correct 496 ms 992 KB Output is correct
46 Correct 578 ms 504 KB Output is correct
47 Correct 497 ms 640 KB Output is correct
48 Correct 500 ms 880 KB Output is correct
49 Correct 495 ms 628 KB Output is correct
50 Correct 505 ms 652 KB Output is correct
51 Correct 2 ms 332 KB Output is correct
52 Correct 576 ms 1048 KB Output is correct
53 Correct 703 ms 812 KB Output is correct
54 Correct 957 ms 984 KB Output is correct
55 Correct 954 ms 1336 KB Output is correct
56 Correct 722 ms 1092 KB Output is correct
57 Execution timed out 1002 ms 1480 KB Time limit exceeded
58 Halted 0 ms 0 KB -