# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299096 | 2020-09-14T13:27:14 Z | TadijaSebez | Bootfall (IZhO17_bootfall) | C++11 | 1000 ms | 1148 KB |
#include <bits/stdc++.h> using namespace std; const int N=505; int n,a[N]; bitset<N*N> DP(int skip){ bitset<N*N> ans; ans[0]=1; for(int i=1;i<=n;i++)if(i!=skip)ans|=ans<<a[i]; return ans; } int ok[N*N]; int main(){ scanf("%i",&n); int sum=0; for(int i=1;i<=n;i++)scanf("%i",&a[i]),sum+=a[i]; bitset<N*N> all=DP(0); if(sum&1||!all[sum/2])return 0*printf("0\n"); for(int i=1;i<=n;i++){ bitset<N*N> dp=DP(i); for(int j=1;j<=sum;j++){ if((sum-a[i]+j)%2==0&&dp[(sum-a[i]+j)/2]) ok[j]++; } } vector<int> ans; for(int i=1;i<=sum;i++)if(ok[i]==n)ans.push_back(i); printf("%i\n",ans.size()); for(int i:ans)printf("%i ",i); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
10 | Correct | 10 ms | 384 KB | Output is correct |
11 | Correct | 11 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 11 ms | 384 KB | Output is correct |
15 | Correct | 9 ms | 384 KB | Output is correct |
16 | Correct | 10 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 11 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
10 | Correct | 10 ms | 384 KB | Output is correct |
11 | Correct | 11 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 11 ms | 384 KB | Output is correct |
15 | Correct | 9 ms | 384 KB | Output is correct |
16 | Correct | 10 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 11 ms | 384 KB | Output is correct |
21 | Correct | 46 ms | 504 KB | Output is correct |
22 | Correct | 59 ms | 512 KB | Output is correct |
23 | Correct | 28 ms | 504 KB | Output is correct |
24 | Correct | 95 ms | 508 KB | Output is correct |
25 | Correct | 98 ms | 512 KB | Output is correct |
26 | Correct | 119 ms | 528 KB | Output is correct |
27 | Correct | 112 ms | 632 KB | Output is correct |
28 | Correct | 109 ms | 512 KB | Output is correct |
29 | Correct | 109 ms | 512 KB | Output is correct |
30 | Correct | 111 ms | 640 KB | Output is correct |
31 | Correct | 109 ms | 512 KB | Output is correct |
32 | Correct | 111 ms | 632 KB | Output is correct |
33 | Correct | 123 ms | 512 KB | Output is correct |
34 | Correct | 109 ms | 532 KB | Output is correct |
35 | Correct | 113 ms | 632 KB | Output is correct |
36 | Correct | 110 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
10 | Correct | 10 ms | 384 KB | Output is correct |
11 | Correct | 11 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 11 ms | 384 KB | Output is correct |
15 | Correct | 9 ms | 384 KB | Output is correct |
16 | Correct | 10 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 11 ms | 384 KB | Output is correct |
21 | Correct | 46 ms | 504 KB | Output is correct |
22 | Correct | 59 ms | 512 KB | Output is correct |
23 | Correct | 28 ms | 504 KB | Output is correct |
24 | Correct | 95 ms | 508 KB | Output is correct |
25 | Correct | 98 ms | 512 KB | Output is correct |
26 | Correct | 119 ms | 528 KB | Output is correct |
27 | Correct | 112 ms | 632 KB | Output is correct |
28 | Correct | 109 ms | 512 KB | Output is correct |
29 | Correct | 109 ms | 512 KB | Output is correct |
30 | Correct | 111 ms | 640 KB | Output is correct |
31 | Correct | 109 ms | 512 KB | Output is correct |
32 | Correct | 111 ms | 632 KB | Output is correct |
33 | Correct | 123 ms | 512 KB | Output is correct |
34 | Correct | 109 ms | 532 KB | Output is correct |
35 | Correct | 113 ms | 632 KB | Output is correct |
36 | Correct | 110 ms | 512 KB | Output is correct |
37 | Correct | 435 ms | 760 KB | Output is correct |
38 | Correct | 454 ms | 632 KB | Output is correct |
39 | Correct | 690 ms | 728 KB | Output is correct |
40 | Correct | 805 ms | 748 KB | Output is correct |
41 | Correct | 823 ms | 772 KB | Output is correct |
42 | Correct | 687 ms | 740 KB | Output is correct |
43 | Correct | 659 ms | 1016 KB | Output is correct |
44 | Correct | 682 ms | 1144 KB | Output is correct |
45 | Correct | 687 ms | 1092 KB | Output is correct |
46 | Correct | 791 ms | 640 KB | Output is correct |
47 | Correct | 707 ms | 760 KB | Output is correct |
48 | Correct | 702 ms | 988 KB | Output is correct |
49 | Correct | 695 ms | 760 KB | Output is correct |
50 | Correct | 677 ms | 760 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 818 ms | 1148 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
10 | Correct | 10 ms | 384 KB | Output is correct |
11 | Correct | 11 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 11 ms | 384 KB | Output is correct |
15 | Correct | 9 ms | 384 KB | Output is correct |
16 | Correct | 10 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 11 ms | 384 KB | Output is correct |
21 | Correct | 46 ms | 504 KB | Output is correct |
22 | Correct | 59 ms | 512 KB | Output is correct |
23 | Correct | 28 ms | 504 KB | Output is correct |
24 | Correct | 95 ms | 508 KB | Output is correct |
25 | Correct | 98 ms | 512 KB | Output is correct |
26 | Correct | 119 ms | 528 KB | Output is correct |
27 | Correct | 112 ms | 632 KB | Output is correct |
28 | Correct | 109 ms | 512 KB | Output is correct |
29 | Correct | 109 ms | 512 KB | Output is correct |
30 | Correct | 111 ms | 640 KB | Output is correct |
31 | Correct | 109 ms | 512 KB | Output is correct |
32 | Correct | 111 ms | 632 KB | Output is correct |
33 | Correct | 123 ms | 512 KB | Output is correct |
34 | Correct | 109 ms | 532 KB | Output is correct |
35 | Correct | 113 ms | 632 KB | Output is correct |
36 | Correct | 110 ms | 512 KB | Output is correct |
37 | Correct | 435 ms | 760 KB | Output is correct |
38 | Correct | 454 ms | 632 KB | Output is correct |
39 | Correct | 690 ms | 728 KB | Output is correct |
40 | Correct | 805 ms | 748 KB | Output is correct |
41 | Correct | 823 ms | 772 KB | Output is correct |
42 | Correct | 687 ms | 740 KB | Output is correct |
43 | Correct | 659 ms | 1016 KB | Output is correct |
44 | Correct | 682 ms | 1144 KB | Output is correct |
45 | Correct | 687 ms | 1092 KB | Output is correct |
46 | Correct | 791 ms | 640 KB | Output is correct |
47 | Correct | 707 ms | 760 KB | Output is correct |
48 | Correct | 702 ms | 988 KB | Output is correct |
49 | Correct | 695 ms | 760 KB | Output is correct |
50 | Correct | 677 ms | 760 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 818 ms | 1148 KB | Output is correct |
53 | Correct | 986 ms | 924 KB | Output is correct |
54 | Execution timed out | 1097 ms | 640 KB | Time limit exceeded |
55 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 512 KB | Output is correct |
10 | Correct | 10 ms | 384 KB | Output is correct |
11 | Correct | 11 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 11 ms | 384 KB | Output is correct |
15 | Correct | 9 ms | 384 KB | Output is correct |
16 | Correct | 10 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 11 ms | 384 KB | Output is correct |
21 | Correct | 46 ms | 504 KB | Output is correct |
22 | Correct | 59 ms | 512 KB | Output is correct |
23 | Correct | 28 ms | 504 KB | Output is correct |
24 | Correct | 95 ms | 508 KB | Output is correct |
25 | Correct | 98 ms | 512 KB | Output is correct |
26 | Correct | 119 ms | 528 KB | Output is correct |
27 | Correct | 112 ms | 632 KB | Output is correct |
28 | Correct | 109 ms | 512 KB | Output is correct |
29 | Correct | 109 ms | 512 KB | Output is correct |
30 | Correct | 111 ms | 640 KB | Output is correct |
31 | Correct | 109 ms | 512 KB | Output is correct |
32 | Correct | 111 ms | 632 KB | Output is correct |
33 | Correct | 123 ms | 512 KB | Output is correct |
34 | Correct | 109 ms | 532 KB | Output is correct |
35 | Correct | 113 ms | 632 KB | Output is correct |
36 | Correct | 110 ms | 512 KB | Output is correct |
37 | Correct | 435 ms | 760 KB | Output is correct |
38 | Correct | 454 ms | 632 KB | Output is correct |
39 | Correct | 690 ms | 728 KB | Output is correct |
40 | Correct | 805 ms | 748 KB | Output is correct |
41 | Correct | 823 ms | 772 KB | Output is correct |
42 | Correct | 687 ms | 740 KB | Output is correct |
43 | Correct | 659 ms | 1016 KB | Output is correct |
44 | Correct | 682 ms | 1144 KB | Output is correct |
45 | Correct | 687 ms | 1092 KB | Output is correct |
46 | Correct | 791 ms | 640 KB | Output is correct |
47 | Correct | 707 ms | 760 KB | Output is correct |
48 | Correct | 702 ms | 988 KB | Output is correct |
49 | Correct | 695 ms | 760 KB | Output is correct |
50 | Correct | 677 ms | 760 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 818 ms | 1148 KB | Output is correct |
53 | Correct | 986 ms | 924 KB | Output is correct |
54 | Execution timed out | 1097 ms | 640 KB | Time limit exceeded |
55 | Halted | 0 ms | 0 KB | - |