답안 #878937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878937 2023-11-25T15:50:38 Z heeheeheehaaw Bootfall (IZhO17_bootfall) C++17
100 / 100
958 ms 2564 KB
#include <bits/stdc++.h>

using namespace std;

bitset<125005> dp;
int v[505], sepoate[250005];

int main()
{
    int n, sum = 0;
    cin>>n;
    dp[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        cin>>v[i], sum += v[i];
        dp = ((dp << v[i]) | dp);
    }

    if(sum % 2 == 1 || dp[sum / 2] == 0)
    {
        cout<<0;
        return 0;
    }

    for(int i = 1; i <= n; i++)
    {
        dp.reset();
        sum -= v[i];
        dp[0] = 1;
        for(int j = 1; j <= n; j++)
        {
            if(j == i) continue;
            dp = ((dp << v[j]) | dp);
        }

        for(int j = 0; j <= sum && j * 2 <= sum; j++)
            if(dp[j] == 1)
                sepoate[sum - 2 * j]++;

        sum += v[i];
    }

    int rez = 0;
    vector<int> aux;
    for(int i = 0; i <= sum; i++)
        if(sepoate[i] == n)
            rez++, aux.push_back(i);
    cout<<rez<<'\n';
    for(auto it : aux) cout<<it<<" ";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 3 ms 488 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 3 ms 488 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 14 ms 348 KB Output is correct
22 Correct 18 ms 348 KB Output is correct
23 Correct 9 ms 348 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 30 ms 512 KB Output is correct
26 Correct 34 ms 344 KB Output is correct
27 Correct 34 ms 348 KB Output is correct
28 Correct 33 ms 528 KB Output is correct
29 Correct 34 ms 344 KB Output is correct
30 Correct 33 ms 348 KB Output is correct
31 Correct 33 ms 344 KB Output is correct
32 Correct 33 ms 544 KB Output is correct
33 Correct 34 ms 348 KB Output is correct
34 Correct 35 ms 344 KB Output is correct
35 Correct 34 ms 344 KB Output is correct
36 Correct 33 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 3 ms 488 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 14 ms 348 KB Output is correct
22 Correct 18 ms 348 KB Output is correct
23 Correct 9 ms 348 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 30 ms 512 KB Output is correct
26 Correct 34 ms 344 KB Output is correct
27 Correct 34 ms 348 KB Output is correct
28 Correct 33 ms 528 KB Output is correct
29 Correct 34 ms 344 KB Output is correct
30 Correct 33 ms 348 KB Output is correct
31 Correct 33 ms 344 KB Output is correct
32 Correct 33 ms 544 KB Output is correct
33 Correct 34 ms 348 KB Output is correct
34 Correct 35 ms 344 KB Output is correct
35 Correct 34 ms 344 KB Output is correct
36 Correct 33 ms 348 KB Output is correct
37 Correct 137 ms 544 KB Output is correct
38 Correct 135 ms 540 KB Output is correct
39 Correct 214 ms 704 KB Output is correct
40 Correct 253 ms 600 KB Output is correct
41 Correct 249 ms 752 KB Output is correct
42 Correct 211 ms 592 KB Output is correct
43 Correct 215 ms 852 KB Output is correct
44 Correct 211 ms 936 KB Output is correct
45 Correct 247 ms 848 KB Output is correct
46 Correct 252 ms 600 KB Output is correct
47 Correct 223 ms 604 KB Output is correct
48 Correct 223 ms 1104 KB Output is correct
49 Correct 240 ms 604 KB Output is correct
50 Correct 217 ms 600 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 274 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 3 ms 488 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 14 ms 348 KB Output is correct
22 Correct 18 ms 348 KB Output is correct
23 Correct 9 ms 348 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 30 ms 512 KB Output is correct
26 Correct 34 ms 344 KB Output is correct
27 Correct 34 ms 348 KB Output is correct
28 Correct 33 ms 528 KB Output is correct
29 Correct 34 ms 344 KB Output is correct
30 Correct 33 ms 348 KB Output is correct
31 Correct 33 ms 344 KB Output is correct
32 Correct 33 ms 544 KB Output is correct
33 Correct 34 ms 348 KB Output is correct
34 Correct 35 ms 344 KB Output is correct
35 Correct 34 ms 344 KB Output is correct
36 Correct 33 ms 348 KB Output is correct
37 Correct 137 ms 544 KB Output is correct
38 Correct 135 ms 540 KB Output is correct
39 Correct 214 ms 704 KB Output is correct
40 Correct 253 ms 600 KB Output is correct
41 Correct 249 ms 752 KB Output is correct
42 Correct 211 ms 592 KB Output is correct
43 Correct 215 ms 852 KB Output is correct
44 Correct 211 ms 936 KB Output is correct
45 Correct 247 ms 848 KB Output is correct
46 Correct 252 ms 600 KB Output is correct
47 Correct 223 ms 604 KB Output is correct
48 Correct 223 ms 1104 KB Output is correct
49 Correct 240 ms 604 KB Output is correct
50 Correct 217 ms 600 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 274 ms 992 KB Output is correct
53 Correct 303 ms 896 KB Output is correct
54 Correct 422 ms 936 KB Output is correct
55 Correct 430 ms 1292 KB Output is correct
56 Correct 332 ms 940 KB Output is correct
57 Correct 449 ms 1556 KB Output is correct
58 Correct 413 ms 964 KB Output is correct
59 Correct 448 ms 1232 KB Output is correct
60 Correct 2 ms 344 KB Output is correct
61 Correct 426 ms 1176 KB Output is correct
62 Correct 370 ms 1216 KB Output is correct
63 Correct 365 ms 1248 KB Output is correct
64 Correct 358 ms 1240 KB Output is correct
65 Correct 334 ms 652 KB Output is correct
66 Correct 338 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 3 ms 488 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 14 ms 348 KB Output is correct
22 Correct 18 ms 348 KB Output is correct
23 Correct 9 ms 348 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 30 ms 512 KB Output is correct
26 Correct 34 ms 344 KB Output is correct
27 Correct 34 ms 348 KB Output is correct
28 Correct 33 ms 528 KB Output is correct
29 Correct 34 ms 344 KB Output is correct
30 Correct 33 ms 348 KB Output is correct
31 Correct 33 ms 344 KB Output is correct
32 Correct 33 ms 544 KB Output is correct
33 Correct 34 ms 348 KB Output is correct
34 Correct 35 ms 344 KB Output is correct
35 Correct 34 ms 344 KB Output is correct
36 Correct 33 ms 348 KB Output is correct
37 Correct 137 ms 544 KB Output is correct
38 Correct 135 ms 540 KB Output is correct
39 Correct 214 ms 704 KB Output is correct
40 Correct 253 ms 600 KB Output is correct
41 Correct 249 ms 752 KB Output is correct
42 Correct 211 ms 592 KB Output is correct
43 Correct 215 ms 852 KB Output is correct
44 Correct 211 ms 936 KB Output is correct
45 Correct 247 ms 848 KB Output is correct
46 Correct 252 ms 600 KB Output is correct
47 Correct 223 ms 604 KB Output is correct
48 Correct 223 ms 1104 KB Output is correct
49 Correct 240 ms 604 KB Output is correct
50 Correct 217 ms 600 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 274 ms 992 KB Output is correct
53 Correct 303 ms 896 KB Output is correct
54 Correct 422 ms 936 KB Output is correct
55 Correct 430 ms 1292 KB Output is correct
56 Correct 332 ms 940 KB Output is correct
57 Correct 449 ms 1556 KB Output is correct
58 Correct 413 ms 964 KB Output is correct
59 Correct 448 ms 1232 KB Output is correct
60 Correct 2 ms 344 KB Output is correct
61 Correct 426 ms 1176 KB Output is correct
62 Correct 370 ms 1216 KB Output is correct
63 Correct 365 ms 1248 KB Output is correct
64 Correct 358 ms 1240 KB Output is correct
65 Correct 334 ms 652 KB Output is correct
66 Correct 338 ms 676 KB Output is correct
67 Correct 570 ms 1236 KB Output is correct
68 Correct 2 ms 348 KB Output is correct
69 Correct 904 ms 2452 KB Output is correct
70 Correct 883 ms 1604 KB Output is correct
71 Correct 869 ms 1740 KB Output is correct
72 Correct 859 ms 1108 KB Output is correct
73 Correct 847 ms 956 KB Output is correct
74 Correct 958 ms 2504 KB Output is correct
75 Correct 892 ms 2248 KB Output is correct
76 Correct 918 ms 2564 KB Output is correct
77 Correct 903 ms 2536 KB Output is correct