# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
77124 | 2018-09-22T13:49:16 Z | zetapi | Bootfall (IZhO17_bootfall) | C++14 | 754 ms | 3088 KB |
#include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll int #define int int #define itr iterator typedef pair<ll,ll> pii; const ll MAX=3e5+9; const ll LIM=3e5; const ll mod=1e9+7; bitset<500*500+9> bs; set<ll> candidate; ll N,sum,arr[500*500+9],dp[500*500+9]; void add(ll X) { sum+=X; for(int A=500*500;A>=X;A--) { dp[A]+=dp[A-X]; if(dp[A]>=mod) dp[A]-=mod; } return ; } void remove(ll X) { sum-=X; for(int A=X;A<=500*500;A++) { dp[A]-=dp[A-X]; if(dp[A]<0) dp[A]+=mod; } return ; } signed main() { scanf("%d",&N); dp[0]=1; for(int A=1;A<=N;A++) { scanf("%d",&arr[A]); add(arr[A]); } if(sum%2 or (!dp[sum/2])) return cout<<0,0; for(int A=1;A<=sum;A++) bs[A]=1; int mn=sum; for(int A=1;A<=N;A++) { remove(arr[A]); mn=min(mn,sum); for(int B=1;B<=sum;B++) { if((sum+B)%2 or (!dp[(sum+B)/2])) bs[B]=0; } add(arr[A]); } vector<int> res; for(int A=1;A<=mn;A++) if(bs[A]) res.pb(A); cout<<res.size()<<"\n"; for(auto A:res) cout<<A<<" "; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
10 | Correct | 28 ms | 1568 KB | Output is correct |
11 | Correct | 32 ms | 1568 KB | Output is correct |
12 | Correct | 29 ms | 1568 KB | Output is correct |
13 | Correct | 27 ms | 1632 KB | Output is correct |
14 | Correct | 27 ms | 1632 KB | Output is correct |
15 | Correct | 31 ms | 1632 KB | Output is correct |
16 | Correct | 34 ms | 1632 KB | Output is correct |
17 | Correct | 19 ms | 1632 KB | Output is correct |
18 | Correct | 32 ms | 1632 KB | Output is correct |
19 | Correct | 26 ms | 1632 KB | Output is correct |
20 | Correct | 28 ms | 1632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
10 | Correct | 28 ms | 1568 KB | Output is correct |
11 | Correct | 32 ms | 1568 KB | Output is correct |
12 | Correct | 29 ms | 1568 KB | Output is correct |
13 | Correct | 27 ms | 1632 KB | Output is correct |
14 | Correct | 27 ms | 1632 KB | Output is correct |
15 | Correct | 31 ms | 1632 KB | Output is correct |
16 | Correct | 34 ms | 1632 KB | Output is correct |
17 | Correct | 19 ms | 1632 KB | Output is correct |
18 | Correct | 32 ms | 1632 KB | Output is correct |
19 | Correct | 26 ms | 1632 KB | Output is correct |
20 | Correct | 28 ms | 1632 KB | Output is correct |
21 | Correct | 64 ms | 1632 KB | Output is correct |
22 | Correct | 68 ms | 1632 KB | Output is correct |
23 | Correct | 52 ms | 1632 KB | Output is correct |
24 | Correct | 88 ms | 1660 KB | Output is correct |
25 | Correct | 91 ms | 1676 KB | Output is correct |
26 | Correct | 97 ms | 1676 KB | Output is correct |
27 | Correct | 89 ms | 1676 KB | Output is correct |
28 | Correct | 91 ms | 1716 KB | Output is correct |
29 | Correct | 90 ms | 1716 KB | Output is correct |
30 | Correct | 93 ms | 1716 KB | Output is correct |
31 | Correct | 112 ms | 1716 KB | Output is correct |
32 | Correct | 115 ms | 1724 KB | Output is correct |
33 | Correct | 90 ms | 1724 KB | Output is correct |
34 | Correct | 92 ms | 1724 KB | Output is correct |
35 | Correct | 91 ms | 1724 KB | Output is correct |
36 | Correct | 98 ms | 1724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
10 | Correct | 28 ms | 1568 KB | Output is correct |
11 | Correct | 32 ms | 1568 KB | Output is correct |
12 | Correct | 29 ms | 1568 KB | Output is correct |
13 | Correct | 27 ms | 1632 KB | Output is correct |
14 | Correct | 27 ms | 1632 KB | Output is correct |
15 | Correct | 31 ms | 1632 KB | Output is correct |
16 | Correct | 34 ms | 1632 KB | Output is correct |
17 | Correct | 19 ms | 1632 KB | Output is correct |
18 | Correct | 32 ms | 1632 KB | Output is correct |
19 | Correct | 26 ms | 1632 KB | Output is correct |
20 | Correct | 28 ms | 1632 KB | Output is correct |
21 | Correct | 64 ms | 1632 KB | Output is correct |
22 | Correct | 68 ms | 1632 KB | Output is correct |
23 | Correct | 52 ms | 1632 KB | Output is correct |
24 | Correct | 88 ms | 1660 KB | Output is correct |
25 | Correct | 91 ms | 1676 KB | Output is correct |
26 | Correct | 97 ms | 1676 KB | Output is correct |
27 | Correct | 89 ms | 1676 KB | Output is correct |
28 | Correct | 91 ms | 1716 KB | Output is correct |
29 | Correct | 90 ms | 1716 KB | Output is correct |
30 | Correct | 93 ms | 1716 KB | Output is correct |
31 | Correct | 112 ms | 1716 KB | Output is correct |
32 | Correct | 115 ms | 1724 KB | Output is correct |
33 | Correct | 90 ms | 1724 KB | Output is correct |
34 | Correct | 92 ms | 1724 KB | Output is correct |
35 | Correct | 91 ms | 1724 KB | Output is correct |
36 | Correct | 98 ms | 1724 KB | Output is correct |
37 | Correct | 191 ms | 1852 KB | Output is correct |
38 | Correct | 183 ms | 1852 KB | Output is correct |
39 | Correct | 255 ms | 1852 KB | Output is correct |
40 | Correct | 304 ms | 1852 KB | Output is correct |
41 | Correct | 284 ms | 1852 KB | Output is correct |
42 | Correct | 237 ms | 1852 KB | Output is correct |
43 | Correct | 252 ms | 1952 KB | Output is correct |
44 | Correct | 247 ms | 2108 KB | Output is correct |
45 | Correct | 268 ms | 2108 KB | Output is correct |
46 | Correct | 288 ms | 2108 KB | Output is correct |
47 | Correct | 237 ms | 2108 KB | Output is correct |
48 | Correct | 260 ms | 2108 KB | Output is correct |
49 | Correct | 253 ms | 2108 KB | Output is correct |
50 | Correct | 243 ms | 2108 KB | Output is correct |
51 | Correct | 78 ms | 2108 KB | Output is correct |
52 | Correct | 292 ms | 2108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
10 | Correct | 28 ms | 1568 KB | Output is correct |
11 | Correct | 32 ms | 1568 KB | Output is correct |
12 | Correct | 29 ms | 1568 KB | Output is correct |
13 | Correct | 27 ms | 1632 KB | Output is correct |
14 | Correct | 27 ms | 1632 KB | Output is correct |
15 | Correct | 31 ms | 1632 KB | Output is correct |
16 | Correct | 34 ms | 1632 KB | Output is correct |
17 | Correct | 19 ms | 1632 KB | Output is correct |
18 | Correct | 32 ms | 1632 KB | Output is correct |
19 | Correct | 26 ms | 1632 KB | Output is correct |
20 | Correct | 28 ms | 1632 KB | Output is correct |
21 | Correct | 64 ms | 1632 KB | Output is correct |
22 | Correct | 68 ms | 1632 KB | Output is correct |
23 | Correct | 52 ms | 1632 KB | Output is correct |
24 | Correct | 88 ms | 1660 KB | Output is correct |
25 | Correct | 91 ms | 1676 KB | Output is correct |
26 | Correct | 97 ms | 1676 KB | Output is correct |
27 | Correct | 89 ms | 1676 KB | Output is correct |
28 | Correct | 91 ms | 1716 KB | Output is correct |
29 | Correct | 90 ms | 1716 KB | Output is correct |
30 | Correct | 93 ms | 1716 KB | Output is correct |
31 | Correct | 112 ms | 1716 KB | Output is correct |
32 | Correct | 115 ms | 1724 KB | Output is correct |
33 | Correct | 90 ms | 1724 KB | Output is correct |
34 | Correct | 92 ms | 1724 KB | Output is correct |
35 | Correct | 91 ms | 1724 KB | Output is correct |
36 | Correct | 98 ms | 1724 KB | Output is correct |
37 | Correct | 191 ms | 1852 KB | Output is correct |
38 | Correct | 183 ms | 1852 KB | Output is correct |
39 | Correct | 255 ms | 1852 KB | Output is correct |
40 | Correct | 304 ms | 1852 KB | Output is correct |
41 | Correct | 284 ms | 1852 KB | Output is correct |
42 | Correct | 237 ms | 1852 KB | Output is correct |
43 | Correct | 252 ms | 1952 KB | Output is correct |
44 | Correct | 247 ms | 2108 KB | Output is correct |
45 | Correct | 268 ms | 2108 KB | Output is correct |
46 | Correct | 288 ms | 2108 KB | Output is correct |
47 | Correct | 237 ms | 2108 KB | Output is correct |
48 | Correct | 260 ms | 2108 KB | Output is correct |
49 | Correct | 253 ms | 2108 KB | Output is correct |
50 | Correct | 243 ms | 2108 KB | Output is correct |
51 | Correct | 78 ms | 2108 KB | Output is correct |
52 | Correct | 292 ms | 2108 KB | Output is correct |
53 | Correct | 294 ms | 2108 KB | Output is correct |
54 | Correct | 381 ms | 2108 KB | Output is correct |
55 | Correct | 392 ms | 2232 KB | Output is correct |
56 | Correct | 336 ms | 2232 KB | Output is correct |
57 | Correct | 382 ms | 2424 KB | Output is correct |
58 | Correct | 367 ms | 2424 KB | Output is correct |
59 | Correct | 359 ms | 2424 KB | Output is correct |
60 | Correct | 114 ms | 2424 KB | Output is correct |
61 | Correct | 410 ms | 2424 KB | Output is correct |
62 | Correct | 340 ms | 2424 KB | Output is correct |
63 | Correct | 372 ms | 2424 KB | Output is correct |
64 | Correct | 356 ms | 2424 KB | Output is correct |
65 | Correct | 332 ms | 2424 KB | Output is correct |
66 | Correct | 321 ms | 2424 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1272 KB | Output is correct |
2 | Correct | 8 ms | 1404 KB | Output is correct |
3 | Correct | 4 ms | 1404 KB | Output is correct |
4 | Correct | 9 ms | 1468 KB | Output is correct |
5 | Correct | 13 ms | 1516 KB | Output is correct |
6 | Correct | 9 ms | 1516 KB | Output is correct |
7 | Correct | 8 ms | 1516 KB | Output is correct |
8 | Correct | 13 ms | 1568 KB | Output is correct |
9 | Correct | 14 ms | 1568 KB | Output is correct |
10 | Correct | 28 ms | 1568 KB | Output is correct |
11 | Correct | 32 ms | 1568 KB | Output is correct |
12 | Correct | 29 ms | 1568 KB | Output is correct |
13 | Correct | 27 ms | 1632 KB | Output is correct |
14 | Correct | 27 ms | 1632 KB | Output is correct |
15 | Correct | 31 ms | 1632 KB | Output is correct |
16 | Correct | 34 ms | 1632 KB | Output is correct |
17 | Correct | 19 ms | 1632 KB | Output is correct |
18 | Correct | 32 ms | 1632 KB | Output is correct |
19 | Correct | 26 ms | 1632 KB | Output is correct |
20 | Correct | 28 ms | 1632 KB | Output is correct |
21 | Correct | 64 ms | 1632 KB | Output is correct |
22 | Correct | 68 ms | 1632 KB | Output is correct |
23 | Correct | 52 ms | 1632 KB | Output is correct |
24 | Correct | 88 ms | 1660 KB | Output is correct |
25 | Correct | 91 ms | 1676 KB | Output is correct |
26 | Correct | 97 ms | 1676 KB | Output is correct |
27 | Correct | 89 ms | 1676 KB | Output is correct |
28 | Correct | 91 ms | 1716 KB | Output is correct |
29 | Correct | 90 ms | 1716 KB | Output is correct |
30 | Correct | 93 ms | 1716 KB | Output is correct |
31 | Correct | 112 ms | 1716 KB | Output is correct |
32 | Correct | 115 ms | 1724 KB | Output is correct |
33 | Correct | 90 ms | 1724 KB | Output is correct |
34 | Correct | 92 ms | 1724 KB | Output is correct |
35 | Correct | 91 ms | 1724 KB | Output is correct |
36 | Correct | 98 ms | 1724 KB | Output is correct |
37 | Correct | 191 ms | 1852 KB | Output is correct |
38 | Correct | 183 ms | 1852 KB | Output is correct |
39 | Correct | 255 ms | 1852 KB | Output is correct |
40 | Correct | 304 ms | 1852 KB | Output is correct |
41 | Correct | 284 ms | 1852 KB | Output is correct |
42 | Correct | 237 ms | 1852 KB | Output is correct |
43 | Correct | 252 ms | 1952 KB | Output is correct |
44 | Correct | 247 ms | 2108 KB | Output is correct |
45 | Correct | 268 ms | 2108 KB | Output is correct |
46 | Correct | 288 ms | 2108 KB | Output is correct |
47 | Correct | 237 ms | 2108 KB | Output is correct |
48 | Correct | 260 ms | 2108 KB | Output is correct |
49 | Correct | 253 ms | 2108 KB | Output is correct |
50 | Correct | 243 ms | 2108 KB | Output is correct |
51 | Correct | 78 ms | 2108 KB | Output is correct |
52 | Correct | 292 ms | 2108 KB | Output is correct |
53 | Correct | 294 ms | 2108 KB | Output is correct |
54 | Correct | 381 ms | 2108 KB | Output is correct |
55 | Correct | 392 ms | 2232 KB | Output is correct |
56 | Correct | 336 ms | 2232 KB | Output is correct |
57 | Correct | 382 ms | 2424 KB | Output is correct |
58 | Correct | 367 ms | 2424 KB | Output is correct |
59 | Correct | 359 ms | 2424 KB | Output is correct |
60 | Correct | 114 ms | 2424 KB | Output is correct |
61 | Correct | 410 ms | 2424 KB | Output is correct |
62 | Correct | 340 ms | 2424 KB | Output is correct |
63 | Correct | 372 ms | 2424 KB | Output is correct |
64 | Correct | 356 ms | 2424 KB | Output is correct |
65 | Correct | 332 ms | 2424 KB | Output is correct |
66 | Correct | 321 ms | 2424 KB | Output is correct |
67 | Correct | 509 ms | 2424 KB | Output is correct |
68 | Correct | 145 ms | 2424 KB | Output is correct |
69 | Correct | 649 ms | 2820 KB | Output is correct |
70 | Correct | 579 ms | 2820 KB | Output is correct |
71 | Correct | 620 ms | 2820 KB | Output is correct |
72 | Correct | 622 ms | 2820 KB | Output is correct |
73 | Correct | 566 ms | 2820 KB | Output is correct |
74 | Correct | 754 ms | 2980 KB | Output is correct |
75 | Correct | 657 ms | 2980 KB | Output is correct |
76 | Correct | 704 ms | 3088 KB | Output is correct |
77 | Correct | 690 ms | 3088 KB | Output is correct |