Submission #494600

# Submission time Handle Problem Language Result Execution time Memory
494600 2021-12-15T20:11:45 Z reni Bootfall (IZhO17_bootfall) C++14
100 / 100
454 ms 3160 KB
#include<iostream>
#define endl '\n'
using namespace std;
long long a[10000000]={1}, b[10000];
bool used[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long m,s,n,i,j, last=0, br=300000;

    cin>>n;

    for(i=0;i<n;i++)
    {
        cin>>b[i];

        for(j=last;j>=0;j--)
        {
           if(a[j]) a[j+b[i]]+=a[j];
           last=max(last,j+b[i]);
        }
    }

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

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

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

        }
        last+=b[i];
    }
    cout<<br<<endl;
    for(j=1;j<=300000;j++)
    {
        if(!used[j])cout<<j<<" ";
    }
    cout<<endl;


}


Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:41:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   41 |                 if(!used[j])br--;used[j]=1;
      |                 ^~
bootfall.cpp:41:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   41 |                 if(!used[j])br--;used[j]=1;
      |                                  ^~~~
bootfall.cpp:12:15: warning: unused variable 'm' [-Wunused-variable]
   12 |     long long m,s,n,i,j, last=0, br=300000;
      |               ^
bootfall.cpp:12:17: warning: unused variable 's' [-Wunused-variable]
   12 |     long long m,s,n,i,j, last=0, br=300000;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
10 Correct 11 ms 588 KB Output is correct
11 Correct 11 ms 624 KB Output is correct
12 Correct 11 ms 588 KB Output is correct
13 Correct 10 ms 588 KB Output is correct
14 Correct 10 ms 588 KB Output is correct
15 Correct 10 ms 716 KB Output is correct
16 Correct 10 ms 588 KB Output is correct
17 Correct 7 ms 588 KB Output is correct
18 Correct 9 ms 588 KB Output is correct
19 Correct 10 ms 620 KB Output is correct
20 Correct 11 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
10 Correct 11 ms 588 KB Output is correct
11 Correct 11 ms 624 KB Output is correct
12 Correct 11 ms 588 KB Output is correct
13 Correct 10 ms 588 KB Output is correct
14 Correct 10 ms 588 KB Output is correct
15 Correct 10 ms 716 KB Output is correct
16 Correct 10 ms 588 KB Output is correct
17 Correct 7 ms 588 KB Output is correct
18 Correct 9 ms 588 KB Output is correct
19 Correct 10 ms 620 KB Output is correct
20 Correct 11 ms 588 KB Output is correct
21 Correct 22 ms 716 KB Output is correct
22 Correct 27 ms 588 KB Output is correct
23 Correct 17 ms 588 KB Output is correct
24 Correct 32 ms 648 KB Output is correct
25 Correct 33 ms 588 KB Output is correct
26 Correct 36 ms 588 KB Output is correct
27 Correct 36 ms 588 KB Output is correct
28 Correct 36 ms 588 KB Output is correct
29 Correct 39 ms 760 KB Output is correct
30 Correct 35 ms 652 KB Output is correct
31 Correct 38 ms 708 KB Output is correct
32 Correct 35 ms 648 KB Output is correct
33 Correct 34 ms 588 KB Output is correct
34 Correct 35 ms 588 KB Output is correct
35 Correct 36 ms 588 KB Output is correct
36 Correct 35 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
10 Correct 11 ms 588 KB Output is correct
11 Correct 11 ms 624 KB Output is correct
12 Correct 11 ms 588 KB Output is correct
13 Correct 10 ms 588 KB Output is correct
14 Correct 10 ms 588 KB Output is correct
15 Correct 10 ms 716 KB Output is correct
16 Correct 10 ms 588 KB Output is correct
17 Correct 7 ms 588 KB Output is correct
18 Correct 9 ms 588 KB Output is correct
19 Correct 10 ms 620 KB Output is correct
20 Correct 11 ms 588 KB Output is correct
21 Correct 22 ms 716 KB Output is correct
22 Correct 27 ms 588 KB Output is correct
23 Correct 17 ms 588 KB Output is correct
24 Correct 32 ms 648 KB Output is correct
25 Correct 33 ms 588 KB Output is correct
26 Correct 36 ms 588 KB Output is correct
27 Correct 36 ms 588 KB Output is correct
28 Correct 36 ms 588 KB Output is correct
29 Correct 39 ms 760 KB Output is correct
30 Correct 35 ms 652 KB Output is correct
31 Correct 38 ms 708 KB Output is correct
32 Correct 35 ms 648 KB Output is correct
33 Correct 34 ms 588 KB Output is correct
34 Correct 35 ms 588 KB Output is correct
35 Correct 36 ms 588 KB Output is correct
36 Correct 35 ms 648 KB Output is correct
37 Correct 77 ms 716 KB Output is correct
38 Correct 73 ms 716 KB Output is correct
39 Correct 109 ms 1100 KB Output is correct
40 Correct 106 ms 868 KB Output is correct
41 Correct 123 ms 1176 KB Output is correct
42 Correct 97 ms 848 KB Output is correct
43 Correct 110 ms 1096 KB Output is correct
44 Correct 125 ms 1224 KB Output is correct
45 Correct 113 ms 1096 KB Output is correct
46 Correct 106 ms 852 KB Output is correct
47 Correct 106 ms 864 KB Output is correct
48 Correct 116 ms 1096 KB Output is correct
49 Correct 122 ms 1100 KB Output is correct
50 Correct 102 ms 868 KB Output is correct
51 Correct 5 ms 456 KB Output is correct
52 Correct 131 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
10 Correct 11 ms 588 KB Output is correct
11 Correct 11 ms 624 KB Output is correct
12 Correct 11 ms 588 KB Output is correct
13 Correct 10 ms 588 KB Output is correct
14 Correct 10 ms 588 KB Output is correct
15 Correct 10 ms 716 KB Output is correct
16 Correct 10 ms 588 KB Output is correct
17 Correct 7 ms 588 KB Output is correct
18 Correct 9 ms 588 KB Output is correct
19 Correct 10 ms 620 KB Output is correct
20 Correct 11 ms 588 KB Output is correct
21 Correct 22 ms 716 KB Output is correct
22 Correct 27 ms 588 KB Output is correct
23 Correct 17 ms 588 KB Output is correct
24 Correct 32 ms 648 KB Output is correct
25 Correct 33 ms 588 KB Output is correct
26 Correct 36 ms 588 KB Output is correct
27 Correct 36 ms 588 KB Output is correct
28 Correct 36 ms 588 KB Output is correct
29 Correct 39 ms 760 KB Output is correct
30 Correct 35 ms 652 KB Output is correct
31 Correct 38 ms 708 KB Output is correct
32 Correct 35 ms 648 KB Output is correct
33 Correct 34 ms 588 KB Output is correct
34 Correct 35 ms 588 KB Output is correct
35 Correct 36 ms 588 KB Output is correct
36 Correct 35 ms 648 KB Output is correct
37 Correct 77 ms 716 KB Output is correct
38 Correct 73 ms 716 KB Output is correct
39 Correct 109 ms 1100 KB Output is correct
40 Correct 106 ms 868 KB Output is correct
41 Correct 123 ms 1176 KB Output is correct
42 Correct 97 ms 848 KB Output is correct
43 Correct 110 ms 1096 KB Output is correct
44 Correct 125 ms 1224 KB Output is correct
45 Correct 113 ms 1096 KB Output is correct
46 Correct 106 ms 852 KB Output is correct
47 Correct 106 ms 864 KB Output is correct
48 Correct 116 ms 1096 KB Output is correct
49 Correct 122 ms 1100 KB Output is correct
50 Correct 102 ms 868 KB Output is correct
51 Correct 5 ms 456 KB Output is correct
52 Correct 131 ms 1280 KB Output is correct
53 Correct 135 ms 1092 KB Output is correct
54 Correct 161 ms 1096 KB Output is correct
55 Correct 207 ms 1732 KB Output is correct
56 Correct 137 ms 1184 KB Output is correct
57 Correct 213 ms 1796 KB Output is correct
58 Correct 158 ms 1220 KB Output is correct
59 Correct 176 ms 1328 KB Output is correct
60 Correct 12 ms 720 KB Output is correct
61 Correct 192 ms 1404 KB Output is correct
62 Correct 172 ms 1736 KB Output is correct
63 Correct 177 ms 1680 KB Output is correct
64 Correct 193 ms 1660 KB Output is correct
65 Correct 148 ms 976 KB Output is correct
66 Correct 135 ms 1040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 5 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 5 ms 588 KB Output is correct
9 Correct 5 ms 588 KB Output is correct
10 Correct 11 ms 588 KB Output is correct
11 Correct 11 ms 624 KB Output is correct
12 Correct 11 ms 588 KB Output is correct
13 Correct 10 ms 588 KB Output is correct
14 Correct 10 ms 588 KB Output is correct
15 Correct 10 ms 716 KB Output is correct
16 Correct 10 ms 588 KB Output is correct
17 Correct 7 ms 588 KB Output is correct
18 Correct 9 ms 588 KB Output is correct
19 Correct 10 ms 620 KB Output is correct
20 Correct 11 ms 588 KB Output is correct
21 Correct 22 ms 716 KB Output is correct
22 Correct 27 ms 588 KB Output is correct
23 Correct 17 ms 588 KB Output is correct
24 Correct 32 ms 648 KB Output is correct
25 Correct 33 ms 588 KB Output is correct
26 Correct 36 ms 588 KB Output is correct
27 Correct 36 ms 588 KB Output is correct
28 Correct 36 ms 588 KB Output is correct
29 Correct 39 ms 760 KB Output is correct
30 Correct 35 ms 652 KB Output is correct
31 Correct 38 ms 708 KB Output is correct
32 Correct 35 ms 648 KB Output is correct
33 Correct 34 ms 588 KB Output is correct
34 Correct 35 ms 588 KB Output is correct
35 Correct 36 ms 588 KB Output is correct
36 Correct 35 ms 648 KB Output is correct
37 Correct 77 ms 716 KB Output is correct
38 Correct 73 ms 716 KB Output is correct
39 Correct 109 ms 1100 KB Output is correct
40 Correct 106 ms 868 KB Output is correct
41 Correct 123 ms 1176 KB Output is correct
42 Correct 97 ms 848 KB Output is correct
43 Correct 110 ms 1096 KB Output is correct
44 Correct 125 ms 1224 KB Output is correct
45 Correct 113 ms 1096 KB Output is correct
46 Correct 106 ms 852 KB Output is correct
47 Correct 106 ms 864 KB Output is correct
48 Correct 116 ms 1096 KB Output is correct
49 Correct 122 ms 1100 KB Output is correct
50 Correct 102 ms 868 KB Output is correct
51 Correct 5 ms 456 KB Output is correct
52 Correct 131 ms 1280 KB Output is correct
53 Correct 135 ms 1092 KB Output is correct
54 Correct 161 ms 1096 KB Output is correct
55 Correct 207 ms 1732 KB Output is correct
56 Correct 137 ms 1184 KB Output is correct
57 Correct 213 ms 1796 KB Output is correct
58 Correct 158 ms 1220 KB Output is correct
59 Correct 176 ms 1328 KB Output is correct
60 Correct 12 ms 720 KB Output is correct
61 Correct 192 ms 1404 KB Output is correct
62 Correct 172 ms 1736 KB Output is correct
63 Correct 177 ms 1680 KB Output is correct
64 Correct 193 ms 1660 KB Output is correct
65 Correct 148 ms 976 KB Output is correct
66 Correct 135 ms 1040 KB Output is correct
67 Correct 195 ms 1360 KB Output is correct
68 Correct 31 ms 1224 KB Output is correct
69 Correct 392 ms 2856 KB Output is correct
70 Correct 315 ms 2120 KB Output is correct
71 Correct 293 ms 1992 KB Output is correct
72 Correct 309 ms 1612 KB Output is correct
73 Correct 298 ms 1584 KB Output is correct
74 Correct 408 ms 3000 KB Output is correct
75 Correct 345 ms 2484 KB Output is correct
76 Correct 446 ms 3160 KB Output is correct
77 Correct 454 ms 3100 KB Output is correct