Submission #488281

# Submission time Handle Problem Language Result Execution time Memory
488281 2021-11-18T12:00:21 Z OttincaM Bootfall (IZhO17_bootfall) C++14
65 / 100
1000 ms 1460 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() {
    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 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 13 ms 392 KB Output is correct
12 Correct 12 ms 392 KB Output is correct
13 Correct 11 ms 388 KB Output is correct
14 Correct 11 ms 336 KB Output is correct
15 Correct 11 ms 392 KB Output is correct
16 Correct 13 ms 396 KB Output is correct
17 Correct 6 ms 336 KB Output is correct
18 Correct 9 ms 336 KB Output is correct
19 Correct 10 ms 336 KB Output is correct
20 Correct 13 ms 392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 13 ms 392 KB Output is correct
12 Correct 12 ms 392 KB Output is correct
13 Correct 11 ms 388 KB Output is correct
14 Correct 11 ms 336 KB Output is correct
15 Correct 11 ms 392 KB Output is correct
16 Correct 13 ms 396 KB Output is correct
17 Correct 6 ms 336 KB Output is correct
18 Correct 9 ms 336 KB Output is correct
19 Correct 10 ms 336 KB Output is correct
20 Correct 13 ms 392 KB Output is correct
21 Correct 44 ms 384 KB Output is correct
22 Correct 54 ms 384 KB Output is correct
23 Correct 28 ms 396 KB Output is correct
24 Correct 80 ms 396 KB Output is correct
25 Correct 78 ms 420 KB Output is correct
26 Correct 86 ms 424 KB Output is correct
27 Correct 88 ms 416 KB Output is correct
28 Correct 89 ms 420 KB Output is correct
29 Correct 87 ms 412 KB Output is correct
30 Correct 88 ms 392 KB Output is correct
31 Correct 87 ms 408 KB Output is correct
32 Correct 88 ms 336 KB Output is correct
33 Correct 85 ms 336 KB Output is correct
34 Correct 94 ms 412 KB Output is correct
35 Correct 89 ms 456 KB Output is correct
36 Correct 86 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 13 ms 392 KB Output is correct
12 Correct 12 ms 392 KB Output is correct
13 Correct 11 ms 388 KB Output is correct
14 Correct 11 ms 336 KB Output is correct
15 Correct 11 ms 392 KB Output is correct
16 Correct 13 ms 396 KB Output is correct
17 Correct 6 ms 336 KB Output is correct
18 Correct 9 ms 336 KB Output is correct
19 Correct 10 ms 336 KB Output is correct
20 Correct 13 ms 392 KB Output is correct
21 Correct 44 ms 384 KB Output is correct
22 Correct 54 ms 384 KB Output is correct
23 Correct 28 ms 396 KB Output is correct
24 Correct 80 ms 396 KB Output is correct
25 Correct 78 ms 420 KB Output is correct
26 Correct 86 ms 424 KB Output is correct
27 Correct 88 ms 416 KB Output is correct
28 Correct 89 ms 420 KB Output is correct
29 Correct 87 ms 412 KB Output is correct
30 Correct 88 ms 392 KB Output is correct
31 Correct 87 ms 408 KB Output is correct
32 Correct 88 ms 336 KB Output is correct
33 Correct 85 ms 336 KB Output is correct
34 Correct 94 ms 412 KB Output is correct
35 Correct 89 ms 456 KB Output is correct
36 Correct 86 ms 404 KB Output is correct
37 Correct 308 ms 572 KB Output is correct
38 Correct 315 ms 588 KB Output is correct
39 Correct 474 ms 608 KB Output is correct
40 Correct 553 ms 712 KB Output is correct
41 Correct 544 ms 656 KB Output is correct
42 Correct 474 ms 616 KB Output is correct
43 Correct 466 ms 1096 KB Output is correct
44 Correct 468 ms 948 KB Output is correct
45 Correct 478 ms 984 KB Output is correct
46 Correct 560 ms 496 KB Output is correct
47 Correct 487 ms 628 KB Output is correct
48 Correct 481 ms 868 KB Output is correct
49 Correct 493 ms 608 KB Output is correct
50 Correct 477 ms 628 KB Output is correct
51 Correct 3 ms 336 KB Output is correct
52 Correct 557 ms 1028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 13 ms 392 KB Output is correct
12 Correct 12 ms 392 KB Output is correct
13 Correct 11 ms 388 KB Output is correct
14 Correct 11 ms 336 KB Output is correct
15 Correct 11 ms 392 KB Output is correct
16 Correct 13 ms 396 KB Output is correct
17 Correct 6 ms 336 KB Output is correct
18 Correct 9 ms 336 KB Output is correct
19 Correct 10 ms 336 KB Output is correct
20 Correct 13 ms 392 KB Output is correct
21 Correct 44 ms 384 KB Output is correct
22 Correct 54 ms 384 KB Output is correct
23 Correct 28 ms 396 KB Output is correct
24 Correct 80 ms 396 KB Output is correct
25 Correct 78 ms 420 KB Output is correct
26 Correct 86 ms 424 KB Output is correct
27 Correct 88 ms 416 KB Output is correct
28 Correct 89 ms 420 KB Output is correct
29 Correct 87 ms 412 KB Output is correct
30 Correct 88 ms 392 KB Output is correct
31 Correct 87 ms 408 KB Output is correct
32 Correct 88 ms 336 KB Output is correct
33 Correct 85 ms 336 KB Output is correct
34 Correct 94 ms 412 KB Output is correct
35 Correct 89 ms 456 KB Output is correct
36 Correct 86 ms 404 KB Output is correct
37 Correct 308 ms 572 KB Output is correct
38 Correct 315 ms 588 KB Output is correct
39 Correct 474 ms 608 KB Output is correct
40 Correct 553 ms 712 KB Output is correct
41 Correct 544 ms 656 KB Output is correct
42 Correct 474 ms 616 KB Output is correct
43 Correct 466 ms 1096 KB Output is correct
44 Correct 468 ms 948 KB Output is correct
45 Correct 478 ms 984 KB Output is correct
46 Correct 560 ms 496 KB Output is correct
47 Correct 487 ms 628 KB Output is correct
48 Correct 481 ms 868 KB Output is correct
49 Correct 493 ms 608 KB Output is correct
50 Correct 477 ms 628 KB Output is correct
51 Correct 3 ms 336 KB Output is correct
52 Correct 557 ms 1028 KB Output is correct
53 Correct 677 ms 792 KB Output is correct
54 Correct 895 ms 964 KB Output is correct
55 Correct 917 ms 1312 KB Output is correct
56 Correct 693 ms 940 KB Output is correct
57 Correct 921 ms 1460 KB Output is correct
58 Correct 897 ms 1096 KB Output is correct
59 Correct 913 ms 1048 KB Output is correct
60 Correct 3 ms 336 KB Output is correct
61 Correct 915 ms 1224 KB Output is correct
62 Correct 782 ms 1244 KB Output is correct
63 Correct 785 ms 1280 KB Output is correct
64 Correct 745 ms 1268 KB Output is correct
65 Correct 734 ms 464 KB Output is correct
66 Correct 714 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 7 ms 396 KB Output is correct
9 Correct 3 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 13 ms 392 KB Output is correct
12 Correct 12 ms 392 KB Output is correct
13 Correct 11 ms 388 KB Output is correct
14 Correct 11 ms 336 KB Output is correct
15 Correct 11 ms 392 KB Output is correct
16 Correct 13 ms 396 KB Output is correct
17 Correct 6 ms 336 KB Output is correct
18 Correct 9 ms 336 KB Output is correct
19 Correct 10 ms 336 KB Output is correct
20 Correct 13 ms 392 KB Output is correct
21 Correct 44 ms 384 KB Output is correct
22 Correct 54 ms 384 KB Output is correct
23 Correct 28 ms 396 KB Output is correct
24 Correct 80 ms 396 KB Output is correct
25 Correct 78 ms 420 KB Output is correct
26 Correct 86 ms 424 KB Output is correct
27 Correct 88 ms 416 KB Output is correct
28 Correct 89 ms 420 KB Output is correct
29 Correct 87 ms 412 KB Output is correct
30 Correct 88 ms 392 KB Output is correct
31 Correct 87 ms 408 KB Output is correct
32 Correct 88 ms 336 KB Output is correct
33 Correct 85 ms 336 KB Output is correct
34 Correct 94 ms 412 KB Output is correct
35 Correct 89 ms 456 KB Output is correct
36 Correct 86 ms 404 KB Output is correct
37 Correct 308 ms 572 KB Output is correct
38 Correct 315 ms 588 KB Output is correct
39 Correct 474 ms 608 KB Output is correct
40 Correct 553 ms 712 KB Output is correct
41 Correct 544 ms 656 KB Output is correct
42 Correct 474 ms 616 KB Output is correct
43 Correct 466 ms 1096 KB Output is correct
44 Correct 468 ms 948 KB Output is correct
45 Correct 478 ms 984 KB Output is correct
46 Correct 560 ms 496 KB Output is correct
47 Correct 487 ms 628 KB Output is correct
48 Correct 481 ms 868 KB Output is correct
49 Correct 493 ms 608 KB Output is correct
50 Correct 477 ms 628 KB Output is correct
51 Correct 3 ms 336 KB Output is correct
52 Correct 557 ms 1028 KB Output is correct
53 Correct 677 ms 792 KB Output is correct
54 Correct 895 ms 964 KB Output is correct
55 Correct 917 ms 1312 KB Output is correct
56 Correct 693 ms 940 KB Output is correct
57 Correct 921 ms 1460 KB Output is correct
58 Correct 897 ms 1096 KB Output is correct
59 Correct 913 ms 1048 KB Output is correct
60 Correct 3 ms 336 KB Output is correct
61 Correct 915 ms 1224 KB Output is correct
62 Correct 782 ms 1244 KB Output is correct
63 Correct 785 ms 1280 KB Output is correct
64 Correct 745 ms 1268 KB Output is correct
65 Correct 734 ms 464 KB Output is correct
66 Correct 714 ms 596 KB Output is correct
67 Execution timed out 1087 ms 644 KB Time limit exceeded
68 Halted 0 ms 0 KB -