# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85703 | 2018-11-21T11:37:13 Z | farukkastamonuda | Bootfall (IZhO17_bootfall) | C++14 | 499 ms | 5580 KB |
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define lo long long #define inf 1000000000 #define md 1000000007 #define pb push_back #define li 505 using namespace std; lo int n,A[li],sum,dp[li*li]; int vis[li*li]; vector<lo int> v; void add(lo int x){ sum+=x; for(lo int i=500*500;i>=x;i--){ dp[i]+=dp[i-x]; } } void del(lo int x){ sum-=x; for(lo int i=x;i<=500*500;i++){ dp[i]-=dp[i-x]; } } int main(){ scanf("%lld",&n); dp[0]=1; for(int i=1;i<=n;i++) {scanf("%lld",&A[i]);add(A[i]);} if(sum%2 || !dp[sum/2]){ printf("0\n"); return 0; } for(int i=1;i<=n;i++){ del(A[i]); for(int j=1;j<=500*500;j++){ if((sum+j)%2!=0 || !dp[(sum+j)/2]){ vis[j]=1; } } add(A[i]); } //~ printf("%d\n",(int)v.size()); //~ return 0; for(int i=1;i<=500*500;i++){ if(!vis[i]) v.pb(i); } printf("%lld\n",(lo int)v.size()); //~ return 0; for(int i=0;i<(int)v.size();i++){ printf("%lld ",v[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
10 | Correct | 32 ms | 3524 KB | Output is correct |
11 | Correct | 44 ms | 3528 KB | Output is correct |
12 | Correct | 45 ms | 3528 KB | Output is correct |
13 | Correct | 28 ms | 3580 KB | Output is correct |
14 | Correct | 30 ms | 3584 KB | Output is correct |
15 | Correct | 32 ms | 3588 KB | Output is correct |
16 | Correct | 33 ms | 3720 KB | Output is correct |
17 | Correct | 22 ms | 3720 KB | Output is correct |
18 | Correct | 27 ms | 3720 KB | Output is correct |
19 | Correct | 33 ms | 3720 KB | Output is correct |
20 | Correct | 32 ms | 3720 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
10 | Correct | 32 ms | 3524 KB | Output is correct |
11 | Correct | 44 ms | 3528 KB | Output is correct |
12 | Correct | 45 ms | 3528 KB | Output is correct |
13 | Correct | 28 ms | 3580 KB | Output is correct |
14 | Correct | 30 ms | 3584 KB | Output is correct |
15 | Correct | 32 ms | 3588 KB | Output is correct |
16 | Correct | 33 ms | 3720 KB | Output is correct |
17 | Correct | 22 ms | 3720 KB | Output is correct |
18 | Correct | 27 ms | 3720 KB | Output is correct |
19 | Correct | 33 ms | 3720 KB | Output is correct |
20 | Correct | 32 ms | 3720 KB | Output is correct |
21 | Correct | 62 ms | 3720 KB | Output is correct |
22 | Correct | 78 ms | 3720 KB | Output is correct |
23 | Correct | 50 ms | 3720 KB | Output is correct |
24 | Correct | 97 ms | 3720 KB | Output is correct |
25 | Correct | 95 ms | 3720 KB | Output is correct |
26 | Correct | 92 ms | 3720 KB | Output is correct |
27 | Correct | 134 ms | 3720 KB | Output is correct |
28 | Correct | 106 ms | 3720 KB | Output is correct |
29 | Correct | 115 ms | 3720 KB | Output is correct |
30 | Correct | 104 ms | 3744 KB | Output is correct |
31 | Correct | 139 ms | 3748 KB | Output is correct |
32 | Correct | 97 ms | 3752 KB | Output is correct |
33 | Correct | 127 ms | 3752 KB | Output is correct |
34 | Correct | 94 ms | 3760 KB | Output is correct |
35 | Correct | 108 ms | 3764 KB | Output is correct |
36 | Correct | 96 ms | 3848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
10 | Correct | 32 ms | 3524 KB | Output is correct |
11 | Correct | 44 ms | 3528 KB | Output is correct |
12 | Correct | 45 ms | 3528 KB | Output is correct |
13 | Correct | 28 ms | 3580 KB | Output is correct |
14 | Correct | 30 ms | 3584 KB | Output is correct |
15 | Correct | 32 ms | 3588 KB | Output is correct |
16 | Correct | 33 ms | 3720 KB | Output is correct |
17 | Correct | 22 ms | 3720 KB | Output is correct |
18 | Correct | 27 ms | 3720 KB | Output is correct |
19 | Correct | 33 ms | 3720 KB | Output is correct |
20 | Correct | 32 ms | 3720 KB | Output is correct |
21 | Correct | 62 ms | 3720 KB | Output is correct |
22 | Correct | 78 ms | 3720 KB | Output is correct |
23 | Correct | 50 ms | 3720 KB | Output is correct |
24 | Correct | 97 ms | 3720 KB | Output is correct |
25 | Correct | 95 ms | 3720 KB | Output is correct |
26 | Correct | 92 ms | 3720 KB | Output is correct |
27 | Correct | 134 ms | 3720 KB | Output is correct |
28 | Correct | 106 ms | 3720 KB | Output is correct |
29 | Correct | 115 ms | 3720 KB | Output is correct |
30 | Correct | 104 ms | 3744 KB | Output is correct |
31 | Correct | 139 ms | 3748 KB | Output is correct |
32 | Correct | 97 ms | 3752 KB | Output is correct |
33 | Correct | 127 ms | 3752 KB | Output is correct |
34 | Correct | 94 ms | 3760 KB | Output is correct |
35 | Correct | 108 ms | 3764 KB | Output is correct |
36 | Correct | 96 ms | 3848 KB | Output is correct |
37 | Correct | 232 ms | 4016 KB | Output is correct |
38 | Correct | 182 ms | 4028 KB | Output is correct |
39 | Correct | 229 ms | 4028 KB | Output is correct |
40 | Correct | 242 ms | 4032 KB | Output is correct |
41 | Correct | 261 ms | 4032 KB | Output is correct |
42 | Correct | 269 ms | 4032 KB | Output is correct |
43 | Correct | 220 ms | 4164 KB | Output is correct |
44 | Correct | 233 ms | 4168 KB | Output is correct |
45 | Correct | 229 ms | 4168 KB | Output is correct |
46 | Correct | 240 ms | 4168 KB | Output is correct |
47 | Correct | 228 ms | 4180 KB | Output is correct |
48 | Correct | 261 ms | 4240 KB | Output is correct |
49 | Correct | 245 ms | 4240 KB | Output is correct |
50 | Correct | 247 ms | 4240 KB | Output is correct |
51 | Correct | 54 ms | 4240 KB | Output is correct |
52 | Correct | 258 ms | 4340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
10 | Correct | 32 ms | 3524 KB | Output is correct |
11 | Correct | 44 ms | 3528 KB | Output is correct |
12 | Correct | 45 ms | 3528 KB | Output is correct |
13 | Correct | 28 ms | 3580 KB | Output is correct |
14 | Correct | 30 ms | 3584 KB | Output is correct |
15 | Correct | 32 ms | 3588 KB | Output is correct |
16 | Correct | 33 ms | 3720 KB | Output is correct |
17 | Correct | 22 ms | 3720 KB | Output is correct |
18 | Correct | 27 ms | 3720 KB | Output is correct |
19 | Correct | 33 ms | 3720 KB | Output is correct |
20 | Correct | 32 ms | 3720 KB | Output is correct |
21 | Correct | 62 ms | 3720 KB | Output is correct |
22 | Correct | 78 ms | 3720 KB | Output is correct |
23 | Correct | 50 ms | 3720 KB | Output is correct |
24 | Correct | 97 ms | 3720 KB | Output is correct |
25 | Correct | 95 ms | 3720 KB | Output is correct |
26 | Correct | 92 ms | 3720 KB | Output is correct |
27 | Correct | 134 ms | 3720 KB | Output is correct |
28 | Correct | 106 ms | 3720 KB | Output is correct |
29 | Correct | 115 ms | 3720 KB | Output is correct |
30 | Correct | 104 ms | 3744 KB | Output is correct |
31 | Correct | 139 ms | 3748 KB | Output is correct |
32 | Correct | 97 ms | 3752 KB | Output is correct |
33 | Correct | 127 ms | 3752 KB | Output is correct |
34 | Correct | 94 ms | 3760 KB | Output is correct |
35 | Correct | 108 ms | 3764 KB | Output is correct |
36 | Correct | 96 ms | 3848 KB | Output is correct |
37 | Correct | 232 ms | 4016 KB | Output is correct |
38 | Correct | 182 ms | 4028 KB | Output is correct |
39 | Correct | 229 ms | 4028 KB | Output is correct |
40 | Correct | 242 ms | 4032 KB | Output is correct |
41 | Correct | 261 ms | 4032 KB | Output is correct |
42 | Correct | 269 ms | 4032 KB | Output is correct |
43 | Correct | 220 ms | 4164 KB | Output is correct |
44 | Correct | 233 ms | 4168 KB | Output is correct |
45 | Correct | 229 ms | 4168 KB | Output is correct |
46 | Correct | 240 ms | 4168 KB | Output is correct |
47 | Correct | 228 ms | 4180 KB | Output is correct |
48 | Correct | 261 ms | 4240 KB | Output is correct |
49 | Correct | 245 ms | 4240 KB | Output is correct |
50 | Correct | 247 ms | 4240 KB | Output is correct |
51 | Correct | 54 ms | 4240 KB | Output is correct |
52 | Correct | 258 ms | 4340 KB | Output is correct |
53 | Correct | 293 ms | 4340 KB | Output is correct |
54 | Correct | 344 ms | 4340 KB | Output is correct |
55 | Correct | 314 ms | 4600 KB | Output is correct |
56 | Correct | 282 ms | 4600 KB | Output is correct |
57 | Correct | 354 ms | 4612 KB | Output is correct |
58 | Correct | 346 ms | 4612 KB | Output is correct |
59 | Correct | 449 ms | 4612 KB | Output is correct |
60 | Correct | 84 ms | 4612 KB | Output is correct |
61 | Correct | 315 ms | 4612 KB | Output is correct |
62 | Correct | 332 ms | 4632 KB | Output is correct |
63 | Correct | 351 ms | 4636 KB | Output is correct |
64 | Correct | 320 ms | 4640 KB | Output is correct |
65 | Correct | 294 ms | 4640 KB | Output is correct |
66 | Correct | 316 ms | 4640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3320 KB | Output is correct |
2 | Correct | 10 ms | 3320 KB | Output is correct |
3 | Correct | 5 ms | 3320 KB | Output is correct |
4 | Correct | 8 ms | 3364 KB | Output is correct |
5 | Correct | 16 ms | 3368 KB | Output is correct |
6 | Correct | 13 ms | 3420 KB | Output is correct |
7 | Correct | 16 ms | 3436 KB | Output is correct |
8 | Correct | 18 ms | 3436 KB | Output is correct |
9 | Correct | 14 ms | 3436 KB | Output is correct |
10 | Correct | 32 ms | 3524 KB | Output is correct |
11 | Correct | 44 ms | 3528 KB | Output is correct |
12 | Correct | 45 ms | 3528 KB | Output is correct |
13 | Correct | 28 ms | 3580 KB | Output is correct |
14 | Correct | 30 ms | 3584 KB | Output is correct |
15 | Correct | 32 ms | 3588 KB | Output is correct |
16 | Correct | 33 ms | 3720 KB | Output is correct |
17 | Correct | 22 ms | 3720 KB | Output is correct |
18 | Correct | 27 ms | 3720 KB | Output is correct |
19 | Correct | 33 ms | 3720 KB | Output is correct |
20 | Correct | 32 ms | 3720 KB | Output is correct |
21 | Correct | 62 ms | 3720 KB | Output is correct |
22 | Correct | 78 ms | 3720 KB | Output is correct |
23 | Correct | 50 ms | 3720 KB | Output is correct |
24 | Correct | 97 ms | 3720 KB | Output is correct |
25 | Correct | 95 ms | 3720 KB | Output is correct |
26 | Correct | 92 ms | 3720 KB | Output is correct |
27 | Correct | 134 ms | 3720 KB | Output is correct |
28 | Correct | 106 ms | 3720 KB | Output is correct |
29 | Correct | 115 ms | 3720 KB | Output is correct |
30 | Correct | 104 ms | 3744 KB | Output is correct |
31 | Correct | 139 ms | 3748 KB | Output is correct |
32 | Correct | 97 ms | 3752 KB | Output is correct |
33 | Correct | 127 ms | 3752 KB | Output is correct |
34 | Correct | 94 ms | 3760 KB | Output is correct |
35 | Correct | 108 ms | 3764 KB | Output is correct |
36 | Correct | 96 ms | 3848 KB | Output is correct |
37 | Correct | 232 ms | 4016 KB | Output is correct |
38 | Correct | 182 ms | 4028 KB | Output is correct |
39 | Correct | 229 ms | 4028 KB | Output is correct |
40 | Correct | 242 ms | 4032 KB | Output is correct |
41 | Correct | 261 ms | 4032 KB | Output is correct |
42 | Correct | 269 ms | 4032 KB | Output is correct |
43 | Correct | 220 ms | 4164 KB | Output is correct |
44 | Correct | 233 ms | 4168 KB | Output is correct |
45 | Correct | 229 ms | 4168 KB | Output is correct |
46 | Correct | 240 ms | 4168 KB | Output is correct |
47 | Correct | 228 ms | 4180 KB | Output is correct |
48 | Correct | 261 ms | 4240 KB | Output is correct |
49 | Correct | 245 ms | 4240 KB | Output is correct |
50 | Correct | 247 ms | 4240 KB | Output is correct |
51 | Correct | 54 ms | 4240 KB | Output is correct |
52 | Correct | 258 ms | 4340 KB | Output is correct |
53 | Correct | 293 ms | 4340 KB | Output is correct |
54 | Correct | 344 ms | 4340 KB | Output is correct |
55 | Correct | 314 ms | 4600 KB | Output is correct |
56 | Correct | 282 ms | 4600 KB | Output is correct |
57 | Correct | 354 ms | 4612 KB | Output is correct |
58 | Correct | 346 ms | 4612 KB | Output is correct |
59 | Correct | 449 ms | 4612 KB | Output is correct |
60 | Correct | 84 ms | 4612 KB | Output is correct |
61 | Correct | 315 ms | 4612 KB | Output is correct |
62 | Correct | 332 ms | 4632 KB | Output is correct |
63 | Correct | 351 ms | 4636 KB | Output is correct |
64 | Correct | 320 ms | 4640 KB | Output is correct |
65 | Correct | 294 ms | 4640 KB | Output is correct |
66 | Correct | 316 ms | 4640 KB | Output is correct |
67 | Correct | 390 ms | 4640 KB | Output is correct |
68 | Correct | 116 ms | 4640 KB | Output is correct |
69 | Correct | 493 ms | 5420 KB | Output is correct |
70 | Correct | 476 ms | 5420 KB | Output is correct |
71 | Correct | 478 ms | 5420 KB | Output is correct |
72 | Correct | 463 ms | 5420 KB | Output is correct |
73 | Correct | 438 ms | 5420 KB | Output is correct |
74 | Correct | 499 ms | 5572 KB | Output is correct |
75 | Correct | 481 ms | 5572 KB | Output is correct |
76 | Correct | 453 ms | 5580 KB | Output is correct |
77 | Correct | 479 ms | 5580 KB | Output is correct |