# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
39857 | 2018-01-21T21:27:25 Z | igzi | Bootfall (IZhO17_bootfall) | C++14 | 526 ms | 5808 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 505; const int mx = 250000; int n; int a[maxn], cnt[mx+505]; int dp[mx+505], temp[mx+505]; vector<int> ans; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int sum = 0; for(int i=1;i<=n;i++) sum += a[i]; dp[0] = 1; for(int i=1;i<=n;i++) { for(int x=mx;x>=0;x--) dp[x+a[i]] += dp[x]; } if(sum%2!=0 || dp[sum/2]==0) return !printf("0"); for(int i=1;i<=n;i++) { memset(temp,0,sizeof(temp)); for(int x=0;x<=mx;x++) { temp[x] += dp[x]; temp[x+a[i]] -= temp[x]; } for(int x=0;x<=mx;x++) { if((sum-a[i]+x)%2==0 && sum-a[i]-x>=0 && temp[(sum-a[i]-x)/2]!=0) cnt[x]++; } } for(int i=1;i<=mx;i++) if(cnt[i]==n) ans.push_back(i); printf("%d\n",ans.size()); for(auto x : ans) printf("%d ",x); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
10 | Correct | 43 ms | 4956 KB | Output is correct |
11 | Correct | 42 ms | 4956 KB | Output is correct |
12 | Correct | 61 ms | 4956 KB | Output is correct |
13 | Correct | 39 ms | 4956 KB | Output is correct |
14 | Correct | 38 ms | 4956 KB | Output is correct |
15 | Correct | 40 ms | 4956 KB | Output is correct |
16 | Correct | 39 ms | 4956 KB | Output is correct |
17 | Correct | 20 ms | 4956 KB | Output is correct |
18 | Correct | 33 ms | 4956 KB | Output is correct |
19 | Correct | 37 ms | 4956 KB | Output is correct |
20 | Correct | 41 ms | 4956 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
10 | Correct | 43 ms | 4956 KB | Output is correct |
11 | Correct | 42 ms | 4956 KB | Output is correct |
12 | Correct | 61 ms | 4956 KB | Output is correct |
13 | Correct | 39 ms | 4956 KB | Output is correct |
14 | Correct | 38 ms | 4956 KB | Output is correct |
15 | Correct | 40 ms | 4956 KB | Output is correct |
16 | Correct | 39 ms | 4956 KB | Output is correct |
17 | Correct | 20 ms | 4956 KB | Output is correct |
18 | Correct | 33 ms | 4956 KB | Output is correct |
19 | Correct | 37 ms | 4956 KB | Output is correct |
20 | Correct | 41 ms | 4956 KB | Output is correct |
21 | Correct | 87 ms | 4956 KB | Output is correct |
22 | Correct | 95 ms | 4956 KB | Output is correct |
23 | Correct | 79 ms | 4956 KB | Output is correct |
24 | Correct | 116 ms | 4956 KB | Output is correct |
25 | Correct | 145 ms | 4956 KB | Output is correct |
26 | Correct | 131 ms | 4956 KB | Output is correct |
27 | Correct | 114 ms | 4956 KB | Output is correct |
28 | Correct | 103 ms | 4956 KB | Output is correct |
29 | Correct | 137 ms | 4956 KB | Output is correct |
30 | Correct | 131 ms | 4956 KB | Output is correct |
31 | Correct | 129 ms | 4956 KB | Output is correct |
32 | Correct | 113 ms | 4956 KB | Output is correct |
33 | Correct | 98 ms | 4956 KB | Output is correct |
34 | Correct | 154 ms | 4956 KB | Output is correct |
35 | Correct | 111 ms | 4956 KB | Output is correct |
36 | Correct | 108 ms | 4956 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
10 | Correct | 43 ms | 4956 KB | Output is correct |
11 | Correct | 42 ms | 4956 KB | Output is correct |
12 | Correct | 61 ms | 4956 KB | Output is correct |
13 | Correct | 39 ms | 4956 KB | Output is correct |
14 | Correct | 38 ms | 4956 KB | Output is correct |
15 | Correct | 40 ms | 4956 KB | Output is correct |
16 | Correct | 39 ms | 4956 KB | Output is correct |
17 | Correct | 20 ms | 4956 KB | Output is correct |
18 | Correct | 33 ms | 4956 KB | Output is correct |
19 | Correct | 37 ms | 4956 KB | Output is correct |
20 | Correct | 41 ms | 4956 KB | Output is correct |
21 | Correct | 87 ms | 4956 KB | Output is correct |
22 | Correct | 95 ms | 4956 KB | Output is correct |
23 | Correct | 79 ms | 4956 KB | Output is correct |
24 | Correct | 116 ms | 4956 KB | Output is correct |
25 | Correct | 145 ms | 4956 KB | Output is correct |
26 | Correct | 131 ms | 4956 KB | Output is correct |
27 | Correct | 114 ms | 4956 KB | Output is correct |
28 | Correct | 103 ms | 4956 KB | Output is correct |
29 | Correct | 137 ms | 4956 KB | Output is correct |
30 | Correct | 131 ms | 4956 KB | Output is correct |
31 | Correct | 129 ms | 4956 KB | Output is correct |
32 | Correct | 113 ms | 4956 KB | Output is correct |
33 | Correct | 98 ms | 4956 KB | Output is correct |
34 | Correct | 154 ms | 4956 KB | Output is correct |
35 | Correct | 111 ms | 4956 KB | Output is correct |
36 | Correct | 108 ms | 4956 KB | Output is correct |
37 | Correct | 254 ms | 5096 KB | Output is correct |
38 | Correct | 266 ms | 5096 KB | Output is correct |
39 | Correct | 317 ms | 4956 KB | Output is correct |
40 | Correct | 299 ms | 5096 KB | Output is correct |
41 | Correct | 299 ms | 4956 KB | Output is correct |
42 | Correct | 275 ms | 5096 KB | Output is correct |
43 | Correct | 311 ms | 5228 KB | Output is correct |
44 | Correct | 319 ms | 5228 KB | Output is correct |
45 | Correct | 296 ms | 5228 KB | Output is correct |
46 | Correct | 389 ms | 4956 KB | Output is correct |
47 | Correct | 303 ms | 5096 KB | Output is correct |
48 | Correct | 299 ms | 5228 KB | Output is correct |
49 | Correct | 311 ms | 5096 KB | Output is correct |
50 | Correct | 297 ms | 5096 KB | Output is correct |
51 | Correct | 69 ms | 4956 KB | Output is correct |
52 | Correct | 352 ms | 5228 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
10 | Correct | 43 ms | 4956 KB | Output is correct |
11 | Correct | 42 ms | 4956 KB | Output is correct |
12 | Correct | 61 ms | 4956 KB | Output is correct |
13 | Correct | 39 ms | 4956 KB | Output is correct |
14 | Correct | 38 ms | 4956 KB | Output is correct |
15 | Correct | 40 ms | 4956 KB | Output is correct |
16 | Correct | 39 ms | 4956 KB | Output is correct |
17 | Correct | 20 ms | 4956 KB | Output is correct |
18 | Correct | 33 ms | 4956 KB | Output is correct |
19 | Correct | 37 ms | 4956 KB | Output is correct |
20 | Correct | 41 ms | 4956 KB | Output is correct |
21 | Correct | 87 ms | 4956 KB | Output is correct |
22 | Correct | 95 ms | 4956 KB | Output is correct |
23 | Correct | 79 ms | 4956 KB | Output is correct |
24 | Correct | 116 ms | 4956 KB | Output is correct |
25 | Correct | 145 ms | 4956 KB | Output is correct |
26 | Correct | 131 ms | 4956 KB | Output is correct |
27 | Correct | 114 ms | 4956 KB | Output is correct |
28 | Correct | 103 ms | 4956 KB | Output is correct |
29 | Correct | 137 ms | 4956 KB | Output is correct |
30 | Correct | 131 ms | 4956 KB | Output is correct |
31 | Correct | 129 ms | 4956 KB | Output is correct |
32 | Correct | 113 ms | 4956 KB | Output is correct |
33 | Correct | 98 ms | 4956 KB | Output is correct |
34 | Correct | 154 ms | 4956 KB | Output is correct |
35 | Correct | 111 ms | 4956 KB | Output is correct |
36 | Correct | 108 ms | 4956 KB | Output is correct |
37 | Correct | 254 ms | 5096 KB | Output is correct |
38 | Correct | 266 ms | 5096 KB | Output is correct |
39 | Correct | 317 ms | 4956 KB | Output is correct |
40 | Correct | 299 ms | 5096 KB | Output is correct |
41 | Correct | 299 ms | 4956 KB | Output is correct |
42 | Correct | 275 ms | 5096 KB | Output is correct |
43 | Correct | 311 ms | 5228 KB | Output is correct |
44 | Correct | 319 ms | 5228 KB | Output is correct |
45 | Correct | 296 ms | 5228 KB | Output is correct |
46 | Correct | 389 ms | 4956 KB | Output is correct |
47 | Correct | 303 ms | 5096 KB | Output is correct |
48 | Correct | 299 ms | 5228 KB | Output is correct |
49 | Correct | 311 ms | 5096 KB | Output is correct |
50 | Correct | 297 ms | 5096 KB | Output is correct |
51 | Correct | 69 ms | 4956 KB | Output is correct |
52 | Correct | 352 ms | 5228 KB | Output is correct |
53 | Correct | 361 ms | 5228 KB | Output is correct |
54 | Correct | 410 ms | 5228 KB | Output is correct |
55 | Correct | 437 ms | 5424 KB | Output is correct |
56 | Correct | 365 ms | 5228 KB | Output is correct |
57 | Correct | 418 ms | 5424 KB | Output is correct |
58 | Correct | 394 ms | 5228 KB | Output is correct |
59 | Correct | 434 ms | 5424 KB | Output is correct |
60 | Correct | 91 ms | 4956 KB | Output is correct |
61 | Correct | 384 ms | 5424 KB | Output is correct |
62 | Correct | 375 ms | 5424 KB | Output is correct |
63 | Correct | 368 ms | 5424 KB | Output is correct |
64 | Correct | 410 ms | 5424 KB | Output is correct |
65 | Correct | 387 ms | 4956 KB | Output is correct |
66 | Correct | 404 ms | 5096 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4956 KB | Output is correct |
2 | Correct | 12 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 10 ms | 4956 KB | Output is correct |
5 | Correct | 21 ms | 4956 KB | Output is correct |
6 | Correct | 17 ms | 4956 KB | Output is correct |
7 | Correct | 5 ms | 4956 KB | Output is correct |
8 | Correct | 18 ms | 4956 KB | Output is correct |
9 | Correct | 12 ms | 4956 KB | Output is correct |
10 | Correct | 43 ms | 4956 KB | Output is correct |
11 | Correct | 42 ms | 4956 KB | Output is correct |
12 | Correct | 61 ms | 4956 KB | Output is correct |
13 | Correct | 39 ms | 4956 KB | Output is correct |
14 | Correct | 38 ms | 4956 KB | Output is correct |
15 | Correct | 40 ms | 4956 KB | Output is correct |
16 | Correct | 39 ms | 4956 KB | Output is correct |
17 | Correct | 20 ms | 4956 KB | Output is correct |
18 | Correct | 33 ms | 4956 KB | Output is correct |
19 | Correct | 37 ms | 4956 KB | Output is correct |
20 | Correct | 41 ms | 4956 KB | Output is correct |
21 | Correct | 87 ms | 4956 KB | Output is correct |
22 | Correct | 95 ms | 4956 KB | Output is correct |
23 | Correct | 79 ms | 4956 KB | Output is correct |
24 | Correct | 116 ms | 4956 KB | Output is correct |
25 | Correct | 145 ms | 4956 KB | Output is correct |
26 | Correct | 131 ms | 4956 KB | Output is correct |
27 | Correct | 114 ms | 4956 KB | Output is correct |
28 | Correct | 103 ms | 4956 KB | Output is correct |
29 | Correct | 137 ms | 4956 KB | Output is correct |
30 | Correct | 131 ms | 4956 KB | Output is correct |
31 | Correct | 129 ms | 4956 KB | Output is correct |
32 | Correct | 113 ms | 4956 KB | Output is correct |
33 | Correct | 98 ms | 4956 KB | Output is correct |
34 | Correct | 154 ms | 4956 KB | Output is correct |
35 | Correct | 111 ms | 4956 KB | Output is correct |
36 | Correct | 108 ms | 4956 KB | Output is correct |
37 | Correct | 254 ms | 5096 KB | Output is correct |
38 | Correct | 266 ms | 5096 KB | Output is correct |
39 | Correct | 317 ms | 4956 KB | Output is correct |
40 | Correct | 299 ms | 5096 KB | Output is correct |
41 | Correct | 299 ms | 4956 KB | Output is correct |
42 | Correct | 275 ms | 5096 KB | Output is correct |
43 | Correct | 311 ms | 5228 KB | Output is correct |
44 | Correct | 319 ms | 5228 KB | Output is correct |
45 | Correct | 296 ms | 5228 KB | Output is correct |
46 | Correct | 389 ms | 4956 KB | Output is correct |
47 | Correct | 303 ms | 5096 KB | Output is correct |
48 | Correct | 299 ms | 5228 KB | Output is correct |
49 | Correct | 311 ms | 5096 KB | Output is correct |
50 | Correct | 297 ms | 5096 KB | Output is correct |
51 | Correct | 69 ms | 4956 KB | Output is correct |
52 | Correct | 352 ms | 5228 KB | Output is correct |
53 | Correct | 361 ms | 5228 KB | Output is correct |
54 | Correct | 410 ms | 5228 KB | Output is correct |
55 | Correct | 437 ms | 5424 KB | Output is correct |
56 | Correct | 365 ms | 5228 KB | Output is correct |
57 | Correct | 418 ms | 5424 KB | Output is correct |
58 | Correct | 394 ms | 5228 KB | Output is correct |
59 | Correct | 434 ms | 5424 KB | Output is correct |
60 | Correct | 91 ms | 4956 KB | Output is correct |
61 | Correct | 384 ms | 5424 KB | Output is correct |
62 | Correct | 375 ms | 5424 KB | Output is correct |
63 | Correct | 368 ms | 5424 KB | Output is correct |
64 | Correct | 410 ms | 5424 KB | Output is correct |
65 | Correct | 387 ms | 4956 KB | Output is correct |
66 | Correct | 404 ms | 5096 KB | Output is correct |
67 | Correct | 474 ms | 5424 KB | Output is correct |
68 | Correct | 130 ms | 4956 KB | Output is correct |
69 | Correct | 502 ms | 5808 KB | Output is correct |
70 | Correct | 488 ms | 5424 KB | Output is correct |
71 | Correct | 521 ms | 5424 KB | Output is correct |
72 | Correct | 511 ms | 4956 KB | Output is correct |
73 | Correct | 526 ms | 4956 KB | Output is correct |
74 | Correct | 491 ms | 5808 KB | Output is correct |
75 | Correct | 492 ms | 5808 KB | Output is correct |
76 | Correct | 485 ms | 5808 KB | Output is correct |
77 | Correct | 511 ms | 5808 KB | Output is correct |