# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549126 | 2022-04-15T08:50:39 Z | Pherokung | Bootfall (IZhO17_bootfall) | C++14 | 434 ms | 3500 KB |
#include<bits/stdc++.h> using namespace std; #define N 500*500 + 10 int n,a[505],sum=0,ans[N],num; bitset<N> dp; void sol(int be,int ed,bitset<N> now){ if(be == ed){ for(int i=1;i<=N;i++){ if(!now[i] || (i <= sum - a[be] - i)) continue; ans[abs((sum - a[be] - i) - i)]++; } return; } int mid = (be+ed)/2; bitset<N> l = now, r = now; for(int i=be;i<=mid;i++) r |= r << a[i]; for(int i=mid+1;i<=ed;i++) l |= l << a[i]; sol(be,mid,l), sol(mid+1,ed,r); } int main(){ scanf("%lld",&n); dp = 1; for(int i=1;i<=n;i++) scanf("%d",&a[i]), dp |= dp << a[i], sum += a[i]; if(sum % 2 || !dp[sum/2]){ printf("0"); return 0;} dp = 1, sol(1,n,dp); for(int i=1;i<=N;i++) if(ans[i] == n) num++; printf("%d\n",num); for(int i=1;i<=N;i++) if(ans[i] == n) printf("%d ",i); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
10 | Correct | 10 ms | 1236 KB | Output is correct |
11 | Correct | 10 ms | 1236 KB | Output is correct |
12 | Correct | 9 ms | 1312 KB | Output is correct |
13 | Correct | 8 ms | 1236 KB | Output is correct |
14 | Correct | 8 ms | 1312 KB | Output is correct |
15 | Correct | 8 ms | 1308 KB | Output is correct |
16 | Correct | 9 ms | 1236 KB | Output is correct |
17 | Correct | 6 ms | 1264 KB | Output is correct |
18 | Correct | 8 ms | 1264 KB | Output is correct |
19 | Correct | 8 ms | 1236 KB | Output is correct |
20 | Correct | 11 ms | 1312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
10 | Correct | 10 ms | 1236 KB | Output is correct |
11 | Correct | 10 ms | 1236 KB | Output is correct |
12 | Correct | 9 ms | 1312 KB | Output is correct |
13 | Correct | 8 ms | 1236 KB | Output is correct |
14 | Correct | 8 ms | 1312 KB | Output is correct |
15 | Correct | 8 ms | 1308 KB | Output is correct |
16 | Correct | 9 ms | 1236 KB | Output is correct |
17 | Correct | 6 ms | 1264 KB | Output is correct |
18 | Correct | 8 ms | 1264 KB | Output is correct |
19 | Correct | 8 ms | 1236 KB | Output is correct |
20 | Correct | 11 ms | 1312 KB | Output is correct |
21 | Correct | 18 ms | 1480 KB | Output is correct |
22 | Correct | 29 ms | 1620 KB | Output is correct |
23 | Correct | 20 ms | 1364 KB | Output is correct |
24 | Correct | 31 ms | 1624 KB | Output is correct |
25 | Correct | 27 ms | 1620 KB | Output is correct |
26 | Correct | 30 ms | 1652 KB | Output is correct |
27 | Correct | 28 ms | 1620 KB | Output is correct |
28 | Correct | 28 ms | 1648 KB | Output is correct |
29 | Correct | 29 ms | 1620 KB | Output is correct |
30 | Correct | 28 ms | 1624 KB | Output is correct |
31 | Correct | 30 ms | 1640 KB | Output is correct |
32 | Correct | 32 ms | 1612 KB | Output is correct |
33 | Correct | 30 ms | 1620 KB | Output is correct |
34 | Correct | 28 ms | 1620 KB | Output is correct |
35 | Correct | 33 ms | 1636 KB | Output is correct |
36 | Correct | 28 ms | 1628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
10 | Correct | 10 ms | 1236 KB | Output is correct |
11 | Correct | 10 ms | 1236 KB | Output is correct |
12 | Correct | 9 ms | 1312 KB | Output is correct |
13 | Correct | 8 ms | 1236 KB | Output is correct |
14 | Correct | 8 ms | 1312 KB | Output is correct |
15 | Correct | 8 ms | 1308 KB | Output is correct |
16 | Correct | 9 ms | 1236 KB | Output is correct |
17 | Correct | 6 ms | 1264 KB | Output is correct |
18 | Correct | 8 ms | 1264 KB | Output is correct |
19 | Correct | 8 ms | 1236 KB | Output is correct |
20 | Correct | 11 ms | 1312 KB | Output is correct |
21 | Correct | 18 ms | 1480 KB | Output is correct |
22 | Correct | 29 ms | 1620 KB | Output is correct |
23 | Correct | 20 ms | 1364 KB | Output is correct |
24 | Correct | 31 ms | 1624 KB | Output is correct |
25 | Correct | 27 ms | 1620 KB | Output is correct |
26 | Correct | 30 ms | 1652 KB | Output is correct |
27 | Correct | 28 ms | 1620 KB | Output is correct |
28 | Correct | 28 ms | 1648 KB | Output is correct |
29 | Correct | 29 ms | 1620 KB | Output is correct |
30 | Correct | 28 ms | 1624 KB | Output is correct |
31 | Correct | 30 ms | 1640 KB | Output is correct |
32 | Correct | 32 ms | 1612 KB | Output is correct |
33 | Correct | 30 ms | 1620 KB | Output is correct |
34 | Correct | 28 ms | 1620 KB | Output is correct |
35 | Correct | 33 ms | 1636 KB | Output is correct |
36 | Correct | 28 ms | 1628 KB | Output is correct |
37 | Correct | 64 ms | 1824 KB | Output is correct |
38 | Correct | 68 ms | 1868 KB | Output is correct |
39 | Correct | 66 ms | 2004 KB | Output is correct |
40 | Correct | 95 ms | 2028 KB | Output is correct |
41 | Correct | 84 ms | 2192 KB | Output is correct |
42 | Correct | 98 ms | 1880 KB | Output is correct |
43 | Correct | 97 ms | 2096 KB | Output is correct |
44 | Correct | 102 ms | 2100 KB | Output is correct |
45 | Correct | 115 ms | 2116 KB | Output is correct |
46 | Correct | 91 ms | 2124 KB | Output is correct |
47 | Correct | 87 ms | 1876 KB | Output is correct |
48 | Correct | 97 ms | 2004 KB | Output is correct |
49 | Correct | 87 ms | 1984 KB | Output is correct |
50 | Correct | 92 ms | 1880 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 125 ms | 2308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
10 | Correct | 10 ms | 1236 KB | Output is correct |
11 | Correct | 10 ms | 1236 KB | Output is correct |
12 | Correct | 9 ms | 1312 KB | Output is correct |
13 | Correct | 8 ms | 1236 KB | Output is correct |
14 | Correct | 8 ms | 1312 KB | Output is correct |
15 | Correct | 8 ms | 1308 KB | Output is correct |
16 | Correct | 9 ms | 1236 KB | Output is correct |
17 | Correct | 6 ms | 1264 KB | Output is correct |
18 | Correct | 8 ms | 1264 KB | Output is correct |
19 | Correct | 8 ms | 1236 KB | Output is correct |
20 | Correct | 11 ms | 1312 KB | Output is correct |
21 | Correct | 18 ms | 1480 KB | Output is correct |
22 | Correct | 29 ms | 1620 KB | Output is correct |
23 | Correct | 20 ms | 1364 KB | Output is correct |
24 | Correct | 31 ms | 1624 KB | Output is correct |
25 | Correct | 27 ms | 1620 KB | Output is correct |
26 | Correct | 30 ms | 1652 KB | Output is correct |
27 | Correct | 28 ms | 1620 KB | Output is correct |
28 | Correct | 28 ms | 1648 KB | Output is correct |
29 | Correct | 29 ms | 1620 KB | Output is correct |
30 | Correct | 28 ms | 1624 KB | Output is correct |
31 | Correct | 30 ms | 1640 KB | Output is correct |
32 | Correct | 32 ms | 1612 KB | Output is correct |
33 | Correct | 30 ms | 1620 KB | Output is correct |
34 | Correct | 28 ms | 1620 KB | Output is correct |
35 | Correct | 33 ms | 1636 KB | Output is correct |
36 | Correct | 28 ms | 1628 KB | Output is correct |
37 | Correct | 64 ms | 1824 KB | Output is correct |
38 | Correct | 68 ms | 1868 KB | Output is correct |
39 | Correct | 66 ms | 2004 KB | Output is correct |
40 | Correct | 95 ms | 2028 KB | Output is correct |
41 | Correct | 84 ms | 2192 KB | Output is correct |
42 | Correct | 98 ms | 1880 KB | Output is correct |
43 | Correct | 97 ms | 2096 KB | Output is correct |
44 | Correct | 102 ms | 2100 KB | Output is correct |
45 | Correct | 115 ms | 2116 KB | Output is correct |
46 | Correct | 91 ms | 2124 KB | Output is correct |
47 | Correct | 87 ms | 1876 KB | Output is correct |
48 | Correct | 97 ms | 2004 KB | Output is correct |
49 | Correct | 87 ms | 1984 KB | Output is correct |
50 | Correct | 92 ms | 1880 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 125 ms | 2308 KB | Output is correct |
53 | Correct | 120 ms | 2208 KB | Output is correct |
54 | Correct | 146 ms | 2248 KB | Output is correct |
55 | Correct | 178 ms | 2600 KB | Output is correct |
56 | Correct | 129 ms | 2268 KB | Output is correct |
57 | Correct | 190 ms | 2612 KB | Output is correct |
58 | Correct | 159 ms | 2268 KB | Output is correct |
59 | Correct | 179 ms | 2328 KB | Output is correct |
60 | Correct | 3 ms | 340 KB | Output is correct |
61 | Correct | 170 ms | 2368 KB | Output is correct |
62 | Correct | 164 ms | 2536 KB | Output is correct |
63 | Correct | 182 ms | 2580 KB | Output is correct |
64 | Correct | 159 ms | 2564 KB | Output is correct |
65 | Correct | 99 ms | 2100 KB | Output is correct |
66 | Correct | 87 ms | 2116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 852 KB | Output is correct |
2 | Correct | 3 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 1108 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 1008 KB | Output is correct |
8 | Correct | 4 ms | 1144 KB | Output is correct |
9 | Correct | 4 ms | 1164 KB | Output is correct |
10 | Correct | 10 ms | 1236 KB | Output is correct |
11 | Correct | 10 ms | 1236 KB | Output is correct |
12 | Correct | 9 ms | 1312 KB | Output is correct |
13 | Correct | 8 ms | 1236 KB | Output is correct |
14 | Correct | 8 ms | 1312 KB | Output is correct |
15 | Correct | 8 ms | 1308 KB | Output is correct |
16 | Correct | 9 ms | 1236 KB | Output is correct |
17 | Correct | 6 ms | 1264 KB | Output is correct |
18 | Correct | 8 ms | 1264 KB | Output is correct |
19 | Correct | 8 ms | 1236 KB | Output is correct |
20 | Correct | 11 ms | 1312 KB | Output is correct |
21 | Correct | 18 ms | 1480 KB | Output is correct |
22 | Correct | 29 ms | 1620 KB | Output is correct |
23 | Correct | 20 ms | 1364 KB | Output is correct |
24 | Correct | 31 ms | 1624 KB | Output is correct |
25 | Correct | 27 ms | 1620 KB | Output is correct |
26 | Correct | 30 ms | 1652 KB | Output is correct |
27 | Correct | 28 ms | 1620 KB | Output is correct |
28 | Correct | 28 ms | 1648 KB | Output is correct |
29 | Correct | 29 ms | 1620 KB | Output is correct |
30 | Correct | 28 ms | 1624 KB | Output is correct |
31 | Correct | 30 ms | 1640 KB | Output is correct |
32 | Correct | 32 ms | 1612 KB | Output is correct |
33 | Correct | 30 ms | 1620 KB | Output is correct |
34 | Correct | 28 ms | 1620 KB | Output is correct |
35 | Correct | 33 ms | 1636 KB | Output is correct |
36 | Correct | 28 ms | 1628 KB | Output is correct |
37 | Correct | 64 ms | 1824 KB | Output is correct |
38 | Correct | 68 ms | 1868 KB | Output is correct |
39 | Correct | 66 ms | 2004 KB | Output is correct |
40 | Correct | 95 ms | 2028 KB | Output is correct |
41 | Correct | 84 ms | 2192 KB | Output is correct |
42 | Correct | 98 ms | 1880 KB | Output is correct |
43 | Correct | 97 ms | 2096 KB | Output is correct |
44 | Correct | 102 ms | 2100 KB | Output is correct |
45 | Correct | 115 ms | 2116 KB | Output is correct |
46 | Correct | 91 ms | 2124 KB | Output is correct |
47 | Correct | 87 ms | 1876 KB | Output is correct |
48 | Correct | 97 ms | 2004 KB | Output is correct |
49 | Correct | 87 ms | 1984 KB | Output is correct |
50 | Correct | 92 ms | 1880 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 125 ms | 2308 KB | Output is correct |
53 | Correct | 120 ms | 2208 KB | Output is correct |
54 | Correct | 146 ms | 2248 KB | Output is correct |
55 | Correct | 178 ms | 2600 KB | Output is correct |
56 | Correct | 129 ms | 2268 KB | Output is correct |
57 | Correct | 190 ms | 2612 KB | Output is correct |
58 | Correct | 159 ms | 2268 KB | Output is correct |
59 | Correct | 179 ms | 2328 KB | Output is correct |
60 | Correct | 3 ms | 340 KB | Output is correct |
61 | Correct | 170 ms | 2368 KB | Output is correct |
62 | Correct | 164 ms | 2536 KB | Output is correct |
63 | Correct | 182 ms | 2580 KB | Output is correct |
64 | Correct | 159 ms | 2564 KB | Output is correct |
65 | Correct | 99 ms | 2100 KB | Output is correct |
66 | Correct | 87 ms | 2116 KB | Output is correct |
67 | Correct | 208 ms | 2344 KB | Output is correct |
68 | Correct | 4 ms | 340 KB | Output is correct |
69 | Correct | 381 ms | 3368 KB | Output is correct |
70 | Correct | 298 ms | 2792 KB | Output is correct |
71 | Correct | 283 ms | 2776 KB | Output is correct |
72 | Correct | 300 ms | 2396 KB | Output is correct |
73 | Correct | 275 ms | 2412 KB | Output is correct |
74 | Correct | 413 ms | 3420 KB | Output is correct |
75 | Correct | 340 ms | 3100 KB | Output is correct |
76 | Correct | 393 ms | 3500 KB | Output is correct |
77 | Correct | 434 ms | 3468 KB | Output is correct |