Submission #598059

# Submission time Handle Problem Language Result Execution time Memory
598059 2022-07-17T13:20:03 Z Summers Bootfall (IZhO17_bootfall) C++14
100 / 100
339 ms 4836 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
long long a[1000000], s[1000000]={1}, ans[250001];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long i,j,n,last=0,br=0;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        for(j=last;j>=0;j--)
        {
            if(s[j])s[j+a[i]]+=s[j];
        }
        last+=a[i];
    }

    if(s[last/2]==0 || last%2!=0){cout<<0<<endl;return 0;}

    for(i=1;i<=n;i++)
    {
        last-=a[i];
        for(j=0;j<=last;j++)
        {
            if(s[j])s[j+a[i]]-=s[j];
        }

        for(j=1;j<=250000;j++)
        {
            if((last+j)%2!=0 || s[(last+j)/2]==0)
            {
                if(ans[j]==0)br++;
                ans[j]=1;
            }
        }
        for(j=last;j>=0;j--)
        {
            if(s[j])s[j+a[i]]+=s[j];
        }
        last+=a[i];

    }
    cout<<250000-br<<endl;

    for(i=1;i<=250000;i++)
    {
        if(ans[i]==0)cout<<i<<" ";
    }
    cout<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 9 ms 2304 KB Output is correct
12 Correct 9 ms 2260 KB Output is correct
13 Correct 8 ms 2260 KB Output is correct
14 Correct 9 ms 2304 KB Output is correct
15 Correct 9 ms 2264 KB Output is correct
16 Correct 9 ms 2264 KB Output is correct
17 Correct 6 ms 2260 KB Output is correct
18 Correct 8 ms 2300 KB Output is correct
19 Correct 9 ms 2300 KB Output is correct
20 Correct 9 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 9 ms 2304 KB Output is correct
12 Correct 9 ms 2260 KB Output is correct
13 Correct 8 ms 2260 KB Output is correct
14 Correct 9 ms 2304 KB Output is correct
15 Correct 9 ms 2264 KB Output is correct
16 Correct 9 ms 2264 KB Output is correct
17 Correct 6 ms 2260 KB Output is correct
18 Correct 8 ms 2300 KB Output is correct
19 Correct 9 ms 2300 KB Output is correct
20 Correct 9 ms 2260 KB Output is correct
21 Correct 20 ms 2260 KB Output is correct
22 Correct 20 ms 2328 KB Output is correct
23 Correct 15 ms 2260 KB Output is correct
24 Correct 26 ms 2328 KB Output is correct
25 Correct 28 ms 2376 KB Output is correct
26 Correct 29 ms 2388 KB Output is correct
27 Correct 39 ms 2372 KB Output is correct
28 Correct 42 ms 2356 KB Output is correct
29 Correct 31 ms 2260 KB Output is correct
30 Correct 28 ms 2260 KB Output is correct
31 Correct 28 ms 2352 KB Output is correct
32 Correct 27 ms 2328 KB Output is correct
33 Correct 31 ms 2356 KB Output is correct
34 Correct 30 ms 2260 KB Output is correct
35 Correct 29 ms 2260 KB Output is correct
36 Correct 27 ms 2332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 9 ms 2304 KB Output is correct
12 Correct 9 ms 2260 KB Output is correct
13 Correct 8 ms 2260 KB Output is correct
14 Correct 9 ms 2304 KB Output is correct
15 Correct 9 ms 2264 KB Output is correct
16 Correct 9 ms 2264 KB Output is correct
17 Correct 6 ms 2260 KB Output is correct
18 Correct 8 ms 2300 KB Output is correct
19 Correct 9 ms 2300 KB Output is correct
20 Correct 9 ms 2260 KB Output is correct
21 Correct 20 ms 2260 KB Output is correct
22 Correct 20 ms 2328 KB Output is correct
23 Correct 15 ms 2260 KB Output is correct
24 Correct 26 ms 2328 KB Output is correct
25 Correct 28 ms 2376 KB Output is correct
26 Correct 29 ms 2388 KB Output is correct
27 Correct 39 ms 2372 KB Output is correct
28 Correct 42 ms 2356 KB Output is correct
29 Correct 31 ms 2260 KB Output is correct
30 Correct 28 ms 2260 KB Output is correct
31 Correct 28 ms 2352 KB Output is correct
32 Correct 27 ms 2328 KB Output is correct
33 Correct 31 ms 2356 KB Output is correct
34 Correct 30 ms 2260 KB Output is correct
35 Correct 29 ms 2260 KB Output is correct
36 Correct 27 ms 2332 KB Output is correct
37 Correct 69 ms 2384 KB Output is correct
38 Correct 63 ms 2432 KB Output is correct
39 Correct 96 ms 2772 KB Output is correct
40 Correct 86 ms 2544 KB Output is correct
41 Correct 110 ms 2772 KB Output is correct
42 Correct 76 ms 2636 KB Output is correct
43 Correct 87 ms 2796 KB Output is correct
44 Correct 92 ms 2864 KB Output is correct
45 Correct 89 ms 2848 KB Output is correct
46 Correct 91 ms 2524 KB Output is correct
47 Correct 82 ms 2536 KB Output is correct
48 Correct 109 ms 2764 KB Output is correct
49 Correct 105 ms 2772 KB Output is correct
50 Correct 76 ms 2636 KB Output is correct
51 Correct 3 ms 596 KB Output is correct
52 Correct 115 ms 2924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 9 ms 2304 KB Output is correct
12 Correct 9 ms 2260 KB Output is correct
13 Correct 8 ms 2260 KB Output is correct
14 Correct 9 ms 2304 KB Output is correct
15 Correct 9 ms 2264 KB Output is correct
16 Correct 9 ms 2264 KB Output is correct
17 Correct 6 ms 2260 KB Output is correct
18 Correct 8 ms 2300 KB Output is correct
19 Correct 9 ms 2300 KB Output is correct
20 Correct 9 ms 2260 KB Output is correct
21 Correct 20 ms 2260 KB Output is correct
22 Correct 20 ms 2328 KB Output is correct
23 Correct 15 ms 2260 KB Output is correct
24 Correct 26 ms 2328 KB Output is correct
25 Correct 28 ms 2376 KB Output is correct
26 Correct 29 ms 2388 KB Output is correct
27 Correct 39 ms 2372 KB Output is correct
28 Correct 42 ms 2356 KB Output is correct
29 Correct 31 ms 2260 KB Output is correct
30 Correct 28 ms 2260 KB Output is correct
31 Correct 28 ms 2352 KB Output is correct
32 Correct 27 ms 2328 KB Output is correct
33 Correct 31 ms 2356 KB Output is correct
34 Correct 30 ms 2260 KB Output is correct
35 Correct 29 ms 2260 KB Output is correct
36 Correct 27 ms 2332 KB Output is correct
37 Correct 69 ms 2384 KB Output is correct
38 Correct 63 ms 2432 KB Output is correct
39 Correct 96 ms 2772 KB Output is correct
40 Correct 86 ms 2544 KB Output is correct
41 Correct 110 ms 2772 KB Output is correct
42 Correct 76 ms 2636 KB Output is correct
43 Correct 87 ms 2796 KB Output is correct
44 Correct 92 ms 2864 KB Output is correct
45 Correct 89 ms 2848 KB Output is correct
46 Correct 91 ms 2524 KB Output is correct
47 Correct 82 ms 2536 KB Output is correct
48 Correct 109 ms 2764 KB Output is correct
49 Correct 105 ms 2772 KB Output is correct
50 Correct 76 ms 2636 KB Output is correct
51 Correct 3 ms 596 KB Output is correct
52 Correct 115 ms 2924 KB Output is correct
53 Correct 106 ms 2656 KB Output is correct
54 Correct 122 ms 2844 KB Output is correct
55 Correct 157 ms 3424 KB Output is correct
56 Correct 131 ms 2856 KB Output is correct
57 Correct 158 ms 3456 KB Output is correct
58 Correct 123 ms 2884 KB Output is correct
59 Correct 137 ms 3004 KB Output is correct
60 Correct 7 ms 724 KB Output is correct
61 Correct 138 ms 3084 KB Output is correct
62 Correct 135 ms 3288 KB Output is correct
63 Correct 159 ms 3348 KB Output is correct
64 Correct 150 ms 3332 KB Output is correct
65 Correct 135 ms 2656 KB Output is correct
66 Correct 148 ms 2696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2260 KB Output is correct
2 Correct 3 ms 2260 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 6 ms 2260 KB Output is correct
6 Correct 4 ms 2260 KB Output is correct
7 Correct 3 ms 2236 KB Output is correct
8 Correct 6 ms 2260 KB Output is correct
9 Correct 5 ms 2260 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 9 ms 2304 KB Output is correct
12 Correct 9 ms 2260 KB Output is correct
13 Correct 8 ms 2260 KB Output is correct
14 Correct 9 ms 2304 KB Output is correct
15 Correct 9 ms 2264 KB Output is correct
16 Correct 9 ms 2264 KB Output is correct
17 Correct 6 ms 2260 KB Output is correct
18 Correct 8 ms 2300 KB Output is correct
19 Correct 9 ms 2300 KB Output is correct
20 Correct 9 ms 2260 KB Output is correct
21 Correct 20 ms 2260 KB Output is correct
22 Correct 20 ms 2328 KB Output is correct
23 Correct 15 ms 2260 KB Output is correct
24 Correct 26 ms 2328 KB Output is correct
25 Correct 28 ms 2376 KB Output is correct
26 Correct 29 ms 2388 KB Output is correct
27 Correct 39 ms 2372 KB Output is correct
28 Correct 42 ms 2356 KB Output is correct
29 Correct 31 ms 2260 KB Output is correct
30 Correct 28 ms 2260 KB Output is correct
31 Correct 28 ms 2352 KB Output is correct
32 Correct 27 ms 2328 KB Output is correct
33 Correct 31 ms 2356 KB Output is correct
34 Correct 30 ms 2260 KB Output is correct
35 Correct 29 ms 2260 KB Output is correct
36 Correct 27 ms 2332 KB Output is correct
37 Correct 69 ms 2384 KB Output is correct
38 Correct 63 ms 2432 KB Output is correct
39 Correct 96 ms 2772 KB Output is correct
40 Correct 86 ms 2544 KB Output is correct
41 Correct 110 ms 2772 KB Output is correct
42 Correct 76 ms 2636 KB Output is correct
43 Correct 87 ms 2796 KB Output is correct
44 Correct 92 ms 2864 KB Output is correct
45 Correct 89 ms 2848 KB Output is correct
46 Correct 91 ms 2524 KB Output is correct
47 Correct 82 ms 2536 KB Output is correct
48 Correct 109 ms 2764 KB Output is correct
49 Correct 105 ms 2772 KB Output is correct
50 Correct 76 ms 2636 KB Output is correct
51 Correct 3 ms 596 KB Output is correct
52 Correct 115 ms 2924 KB Output is correct
53 Correct 106 ms 2656 KB Output is correct
54 Correct 122 ms 2844 KB Output is correct
55 Correct 157 ms 3424 KB Output is correct
56 Correct 131 ms 2856 KB Output is correct
57 Correct 158 ms 3456 KB Output is correct
58 Correct 123 ms 2884 KB Output is correct
59 Correct 137 ms 3004 KB Output is correct
60 Correct 7 ms 724 KB Output is correct
61 Correct 138 ms 3084 KB Output is correct
62 Correct 135 ms 3288 KB Output is correct
63 Correct 159 ms 3348 KB Output is correct
64 Correct 150 ms 3332 KB Output is correct
65 Correct 135 ms 2656 KB Output is correct
66 Correct 148 ms 2696 KB Output is correct
67 Correct 153 ms 3148 KB Output is correct
68 Correct 38 ms 1192 KB Output is correct
69 Correct 312 ms 4572 KB Output is correct
70 Correct 234 ms 3676 KB Output is correct
71 Correct 226 ms 3512 KB Output is correct
72 Correct 221 ms 3264 KB Output is correct
73 Correct 215 ms 3264 KB Output is correct
74 Correct 334 ms 4676 KB Output is correct
75 Correct 290 ms 4112 KB Output is correct
76 Correct 339 ms 4836 KB Output is correct
77 Correct 333 ms 4772 KB Output is correct