Submission #494599

# Submission time Handle Problem Language Result Execution time Memory
494599 2021-12-15T20:10:38 Z reni Bootfall (IZhO17_bootfall) C++14
28 / 100
52 ms 720 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=30000;

    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<=30000;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<=30000;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=30000;
      |               ^
bootfall.cpp:12:17: warning: unused variable 's' [-Wunused-variable]
   12 |     long long m,s,n,i,j, last=0, br=30000;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 3 ms 332 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 5 ms 336 KB Output is correct
26 Correct 9 ms 336 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 8 ms 336 KB Output is correct
29 Correct 6 ms 336 KB Output is correct
30 Correct 5 ms 336 KB Output is correct
31 Correct 7 ms 336 KB Output is correct
32 Correct 5 ms 328 KB Output is correct
33 Correct 6 ms 336 KB Output is correct
34 Correct 7 ms 336 KB Output is correct
35 Correct 8 ms 336 KB Output is correct
36 Correct 5 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 3 ms 332 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 5 ms 336 KB Output is correct
26 Correct 9 ms 336 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 8 ms 336 KB Output is correct
29 Correct 6 ms 336 KB Output is correct
30 Correct 5 ms 336 KB Output is correct
31 Correct 7 ms 336 KB Output is correct
32 Correct 5 ms 328 KB Output is correct
33 Correct 6 ms 336 KB Output is correct
34 Correct 7 ms 336 KB Output is correct
35 Correct 8 ms 336 KB Output is correct
36 Correct 5 ms 336 KB Output is correct
37 Correct 18 ms 464 KB Output is correct
38 Correct 16 ms 464 KB Output is correct
39 Incorrect 52 ms 720 KB Output isn't correct
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 3 ms 332 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 5 ms 336 KB Output is correct
26 Correct 9 ms 336 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 8 ms 336 KB Output is correct
29 Correct 6 ms 336 KB Output is correct
30 Correct 5 ms 336 KB Output is correct
31 Correct 7 ms 336 KB Output is correct
32 Correct 5 ms 328 KB Output is correct
33 Correct 6 ms 336 KB Output is correct
34 Correct 7 ms 336 KB Output is correct
35 Correct 8 ms 336 KB Output is correct
36 Correct 5 ms 336 KB Output is correct
37 Correct 18 ms 464 KB Output is correct
38 Correct 16 ms 464 KB Output is correct
39 Incorrect 52 ms 720 KB Output isn't correct
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 3 ms 332 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 5 ms 336 KB Output is correct
26 Correct 9 ms 336 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 8 ms 336 KB Output is correct
29 Correct 6 ms 336 KB Output is correct
30 Correct 5 ms 336 KB Output is correct
31 Correct 7 ms 336 KB Output is correct
32 Correct 5 ms 328 KB Output is correct
33 Correct 6 ms 336 KB Output is correct
34 Correct 7 ms 336 KB Output is correct
35 Correct 8 ms 336 KB Output is correct
36 Correct 5 ms 336 KB Output is correct
37 Correct 18 ms 464 KB Output is correct
38 Correct 16 ms 464 KB Output is correct
39 Incorrect 52 ms 720 KB Output isn't correct
40 Halted 0 ms 0 KB -