Submission #724340

# Submission time Handle Problem Language Result Execution time Memory
724340 2023-04-15T06:05:55 Z Denkata Bootfall (IZhO17_bootfall) C++14
65 / 100
1000 ms 712 KB
#include<bits/stdc++.h>
#define endl '\n'
#pragma GCC optimize("Ofast")
using namespace std;
const int maxn = 503;
bitset <250006> ans;
bitset <250006> tek;
bitset <250006> newtek;
int i,j,p,q,n,m,k,sum;
int a[maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%2!=0)
    {
        cout<<0<<endl;
        return 0;
    }
    for(i=2;i<=n;i++)
    {
        if(a[i]%2!=a[i-1]%2)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    bitset <250006> tek;
    tek.set(0);
    tek[0]=true;
    for(i=1;i<=n;i++)
    {
        tek|=(tek<<a[i]);
    }
    if(!tek[sum/2])
    {
        cout<<0<<endl;
        return 0;
    }
    for(i=1;i<sum;i++)
        ans[i]=1;
    tek.set(false);
    for(i=1;i<=n;i++)
    {
        ///bez i
        bitset <250006> tek;
        tek[0]=1;
        for(j=1;j<=n;j++)
        {
            if(j==i)continue;
            tek|=(tek<<(2*a[j]));
        }

        tek=(tek<<(a[i]));
        tek[0]=1;

        ans&=tek;

    }
    int br = 0;
    for(i=1;i<sum;i++)
        if(ans[i])br++;
    cout<<br<<endl;
    for(i=sum-1;i>=1;i--)
    {
        if(ans[i])
            cout<<sum-i<<" ";
    }
    return 0;
}
/**
4
1 3 1 5

4
200 200 200 200
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 5 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 4 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 5 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 5 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 4 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 5 ms 468 KB Output is correct
21 Correct 21 ms 472 KB Output is correct
22 Correct 31 ms 468 KB Output is correct
23 Correct 13 ms 468 KB Output is correct
24 Correct 47 ms 460 KB Output is correct
25 Correct 44 ms 468 KB Output is correct
26 Correct 52 ms 460 KB Output is correct
27 Correct 51 ms 468 KB Output is correct
28 Correct 50 ms 448 KB Output is correct
29 Correct 50 ms 468 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 61 ms 468 KB Output is correct
32 Correct 56 ms 468 KB Output is correct
33 Correct 54 ms 340 KB Output is correct
34 Correct 59 ms 448 KB Output is correct
35 Correct 53 ms 340 KB Output is correct
36 Correct 50 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 5 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 4 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 5 ms 468 KB Output is correct
21 Correct 21 ms 472 KB Output is correct
22 Correct 31 ms 468 KB Output is correct
23 Correct 13 ms 468 KB Output is correct
24 Correct 47 ms 460 KB Output is correct
25 Correct 44 ms 468 KB Output is correct
26 Correct 52 ms 460 KB Output is correct
27 Correct 51 ms 468 KB Output is correct
28 Correct 50 ms 448 KB Output is correct
29 Correct 50 ms 468 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 61 ms 468 KB Output is correct
32 Correct 56 ms 468 KB Output is correct
33 Correct 54 ms 340 KB Output is correct
34 Correct 59 ms 448 KB Output is correct
35 Correct 53 ms 340 KB Output is correct
36 Correct 50 ms 448 KB Output is correct
37 Correct 198 ms 468 KB Output is correct
38 Correct 192 ms 468 KB Output is correct
39 Correct 303 ms 452 KB Output is correct
40 Correct 358 ms 460 KB Output is correct
41 Correct 350 ms 468 KB Output is correct
42 Correct 304 ms 468 KB Output is correct
43 Correct 290 ms 596 KB Output is correct
44 Correct 308 ms 584 KB Output is correct
45 Correct 302 ms 580 KB Output is correct
46 Correct 347 ms 468 KB Output is correct
47 Correct 310 ms 468 KB Output is correct
48 Correct 314 ms 468 KB Output is correct
49 Correct 301 ms 468 KB Output is correct
50 Correct 305 ms 468 KB Output is correct
51 Correct 0 ms 340 KB Output is correct
52 Correct 353 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 5 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 4 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 5 ms 468 KB Output is correct
21 Correct 21 ms 472 KB Output is correct
22 Correct 31 ms 468 KB Output is correct
23 Correct 13 ms 468 KB Output is correct
24 Correct 47 ms 460 KB Output is correct
25 Correct 44 ms 468 KB Output is correct
26 Correct 52 ms 460 KB Output is correct
27 Correct 51 ms 468 KB Output is correct
28 Correct 50 ms 448 KB Output is correct
29 Correct 50 ms 468 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 61 ms 468 KB Output is correct
32 Correct 56 ms 468 KB Output is correct
33 Correct 54 ms 340 KB Output is correct
34 Correct 59 ms 448 KB Output is correct
35 Correct 53 ms 340 KB Output is correct
36 Correct 50 ms 448 KB Output is correct
37 Correct 198 ms 468 KB Output is correct
38 Correct 192 ms 468 KB Output is correct
39 Correct 303 ms 452 KB Output is correct
40 Correct 358 ms 460 KB Output is correct
41 Correct 350 ms 468 KB Output is correct
42 Correct 304 ms 468 KB Output is correct
43 Correct 290 ms 596 KB Output is correct
44 Correct 308 ms 584 KB Output is correct
45 Correct 302 ms 580 KB Output is correct
46 Correct 347 ms 468 KB Output is correct
47 Correct 310 ms 468 KB Output is correct
48 Correct 314 ms 468 KB Output is correct
49 Correct 301 ms 468 KB Output is correct
50 Correct 305 ms 468 KB Output is correct
51 Correct 0 ms 340 KB Output is correct
52 Correct 353 ms 580 KB Output is correct
53 Correct 434 ms 576 KB Output is correct
54 Correct 587 ms 592 KB Output is correct
55 Correct 628 ms 704 KB Output is correct
56 Correct 471 ms 588 KB Output is correct
57 Correct 602 ms 704 KB Output is correct
58 Correct 605 ms 572 KB Output is correct
59 Correct 600 ms 588 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 610 ms 580 KB Output is correct
62 Correct 499 ms 704 KB Output is correct
63 Correct 508 ms 712 KB Output is correct
64 Correct 480 ms 704 KB Output is correct
65 Correct 482 ms 468 KB Output is correct
66 Correct 466 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 5 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 4 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 5 ms 468 KB Output is correct
21 Correct 21 ms 472 KB Output is correct
22 Correct 31 ms 468 KB Output is correct
23 Correct 13 ms 468 KB Output is correct
24 Correct 47 ms 460 KB Output is correct
25 Correct 44 ms 468 KB Output is correct
26 Correct 52 ms 460 KB Output is correct
27 Correct 51 ms 468 KB Output is correct
28 Correct 50 ms 448 KB Output is correct
29 Correct 50 ms 468 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 61 ms 468 KB Output is correct
32 Correct 56 ms 468 KB Output is correct
33 Correct 54 ms 340 KB Output is correct
34 Correct 59 ms 448 KB Output is correct
35 Correct 53 ms 340 KB Output is correct
36 Correct 50 ms 448 KB Output is correct
37 Correct 198 ms 468 KB Output is correct
38 Correct 192 ms 468 KB Output is correct
39 Correct 303 ms 452 KB Output is correct
40 Correct 358 ms 460 KB Output is correct
41 Correct 350 ms 468 KB Output is correct
42 Correct 304 ms 468 KB Output is correct
43 Correct 290 ms 596 KB Output is correct
44 Correct 308 ms 584 KB Output is correct
45 Correct 302 ms 580 KB Output is correct
46 Correct 347 ms 468 KB Output is correct
47 Correct 310 ms 468 KB Output is correct
48 Correct 314 ms 468 KB Output is correct
49 Correct 301 ms 468 KB Output is correct
50 Correct 305 ms 468 KB Output is correct
51 Correct 0 ms 340 KB Output is correct
52 Correct 353 ms 580 KB Output is correct
53 Correct 434 ms 576 KB Output is correct
54 Correct 587 ms 592 KB Output is correct
55 Correct 628 ms 704 KB Output is correct
56 Correct 471 ms 588 KB Output is correct
57 Correct 602 ms 704 KB Output is correct
58 Correct 605 ms 572 KB Output is correct
59 Correct 600 ms 588 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 610 ms 580 KB Output is correct
62 Correct 499 ms 704 KB Output is correct
63 Correct 508 ms 712 KB Output is correct
64 Correct 480 ms 704 KB Output is correct
65 Correct 482 ms 468 KB Output is correct
66 Correct 466 ms 468 KB Output is correct
67 Correct 787 ms 576 KB Output is correct
68 Correct 3 ms 452 KB Output is correct
69 Execution timed out 1092 ms 468 KB Time limit exceeded
70 Halted 0 ms 0 KB -