# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169564 | 2019-12-21T05:39:41 Z | Gurban | Bootfall (IZhO17_bootfall) | C++14 | 439 ms | 3628 KB |
#include <bits/stdc++.h> #define pb push_back #define ss second #define ff first #define N 250009 #define inf 1000000009 #define ll long long #define mid(a,b) (a+b)/2 using namespace std; int n,a[509],sum,dp[N],s,vis[N]; vector <int> v; const int mod = 1e9+7; int main() { scanf("%d",&n); for(int i = 1;i <= n;i++){ scanf("%d",&a[i]); sum += a[i]; } dp[0] = 1; for(int i = 1;i <= n;i++) for(int j = sum;j >= 0;j--) dp[j + a[i]] += dp[j]; if(sum % 2 == 1 or dp[sum / 2] == 0) return cout << 0,0; for(int i = 1;i <= n;i++){ for(int j = a[i];j <= sum;j++) dp[j] -= dp[j - a[i]]; for(int j = 1;j < sum;j++){ if(vis[j] < i - 1) continue; s = sum - a[i] + j; if(s % 2 == 0 and s / 2 - j >= 0 and dp[s / 2 - j]) vis[j]++; } for(int j = sum;j >= a[i];j--) dp[j] += dp[j - a[i]]; } for(int i = 1;i <= sum;i++) if(vis[i] == n) v.pb(i); printf("%d\n",v.size()); for(auto i : v) printf("%d\n",i); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 252 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 504 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 504 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 380 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 380 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 252 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 504 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 504 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 380 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 380 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 632 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 760 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 772 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1144 KB | Output is correct |
46 | Correct | 27 ms | 504 KB | Output is correct |
47 | Correct | 33 ms | 764 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 49 ms | 888 KB | Output is correct |
50 | Correct | 33 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 252 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 504 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 504 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 380 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 380 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 632 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 760 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 772 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1144 KB | Output is correct |
46 | Correct | 27 ms | 504 KB | Output is correct |
47 | Correct | 33 ms | 764 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 49 ms | 888 KB | Output is correct |
50 | Correct | 33 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1400 KB | Output is correct |
53 | Correct | 53 ms | 1016 KB | Output is correct |
54 | Correct | 74 ms | 1116 KB | Output is correct |
55 | Correct | 142 ms | 1784 KB | Output is correct |
56 | Correct | 66 ms | 1232 KB | Output is correct |
57 | Correct | 151 ms | 1980 KB | Output is correct |
58 | Correct | 81 ms | 1272 KB | Output is correct |
59 | Correct | 101 ms | 1484 KB | Output is correct |
60 | Correct | 15 ms | 632 KB | Output is correct |
61 | Correct | 113 ms | 1524 KB | Output is correct |
62 | Correct | 115 ms | 1628 KB | Output is correct |
63 | Correct | 124 ms | 1780 KB | Output is correct |
64 | Correct | 120 ms | 1780 KB | Output is correct |
65 | Correct | 50 ms | 760 KB | Output is correct |
66 | Correct | 53 ms | 888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 252 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 504 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 504 KB | Output is correct |
28 | Correct | 5 ms | 376 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 380 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 380 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 632 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 760 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 772 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1144 KB | Output is correct |
46 | Correct | 27 ms | 504 KB | Output is correct |
47 | Correct | 33 ms | 764 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 49 ms | 888 KB | Output is correct |
50 | Correct | 33 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1400 KB | Output is correct |
53 | Correct | 53 ms | 1016 KB | Output is correct |
54 | Correct | 74 ms | 1116 KB | Output is correct |
55 | Correct | 142 ms | 1784 KB | Output is correct |
56 | Correct | 66 ms | 1232 KB | Output is correct |
57 | Correct | 151 ms | 1980 KB | Output is correct |
58 | Correct | 81 ms | 1272 KB | Output is correct |
59 | Correct | 101 ms | 1484 KB | Output is correct |
60 | Correct | 15 ms | 632 KB | Output is correct |
61 | Correct | 113 ms | 1524 KB | Output is correct |
62 | Correct | 115 ms | 1628 KB | Output is correct |
63 | Correct | 124 ms | 1780 KB | Output is correct |
64 | Correct | 120 ms | 1780 KB | Output is correct |
65 | Correct | 50 ms | 760 KB | Output is correct |
66 | Correct | 53 ms | 888 KB | Output is correct |
67 | Correct | 120 ms | 1496 KB | Output is correct |
68 | Correct | 41 ms | 760 KB | Output is correct |
69 | Correct | 388 ms | 3108 KB | Output is correct |
70 | Correct | 236 ms | 2164 KB | Output is correct |
71 | Correct | 229 ms | 2164 KB | Output is correct |
72 | Correct | 184 ms | 1400 KB | Output is correct |
73 | Correct | 182 ms | 1272 KB | Output is correct |
74 | Correct | 407 ms | 3312 KB | Output is correct |
75 | Correct | 318 ms | 2800 KB | Output is correct |
76 | Correct | 437 ms | 3540 KB | Output is correct |
77 | Correct | 439 ms | 3628 KB | Output is correct |