# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77122 | 2018-09-22T13:46:26 Z | zetapi | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 12216 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++) candidate.insert(A); vector<int> lol; for(int A=1;A<=N;A++) { remove(arr[A]); for(auto B:candidate) { if(B>sum or (sum+B)%2 or (!dp[(sum+B)/2])) lol.pb(B); } while(!lol.empty()) { candidate.erase(lol.back()); lol.pop_back(); } add(arr[A]); } cout<<candidate.size()<<"\n"; for(auto A:candidate) cout<<A<<" "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
10 | Correct | 28 ms | 1612 KB | Output is correct |
11 | Correct | 33 ms | 1612 KB | Output is correct |
12 | Correct | 36 ms | 1612 KB | Output is correct |
13 | Correct | 28 ms | 1612 KB | Output is correct |
14 | Correct | 28 ms | 1612 KB | Output is correct |
15 | Correct | 29 ms | 1612 KB | Output is correct |
16 | Correct | 32 ms | 1612 KB | Output is correct |
17 | Correct | 19 ms | 1612 KB | Output is correct |
18 | Correct | 25 ms | 1612 KB | Output is correct |
19 | Correct | 26 ms | 1612 KB | Output is correct |
20 | Correct | 28 ms | 1612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
10 | Correct | 28 ms | 1612 KB | Output is correct |
11 | Correct | 33 ms | 1612 KB | Output is correct |
12 | Correct | 36 ms | 1612 KB | Output is correct |
13 | Correct | 28 ms | 1612 KB | Output is correct |
14 | Correct | 28 ms | 1612 KB | Output is correct |
15 | Correct | 29 ms | 1612 KB | Output is correct |
16 | Correct | 32 ms | 1612 KB | Output is correct |
17 | Correct | 19 ms | 1612 KB | Output is correct |
18 | Correct | 25 ms | 1612 KB | Output is correct |
19 | Correct | 26 ms | 1612 KB | Output is correct |
20 | Correct | 28 ms | 1612 KB | Output is correct |
21 | Correct | 67 ms | 1756 KB | Output is correct |
22 | Correct | 68 ms | 1756 KB | Output is correct |
23 | Correct | 47 ms | 1756 KB | Output is correct |
24 | Correct | 89 ms | 1888 KB | Output is correct |
25 | Correct | 88 ms | 2120 KB | Output is correct |
26 | Correct | 102 ms | 2120 KB | Output is correct |
27 | Correct | 103 ms | 2204 KB | Output is correct |
28 | Correct | 95 ms | 2204 KB | Output is correct |
29 | Correct | 89 ms | 2220 KB | Output is correct |
30 | Correct | 86 ms | 2220 KB | Output is correct |
31 | Correct | 95 ms | 2220 KB | Output is correct |
32 | Correct | 134 ms | 2220 KB | Output is correct |
33 | Correct | 91 ms | 2352 KB | Output is correct |
34 | Correct | 88 ms | 2352 KB | Output is correct |
35 | Correct | 88 ms | 2352 KB | Output is correct |
36 | Correct | 93 ms | 2352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
10 | Correct | 28 ms | 1612 KB | Output is correct |
11 | Correct | 33 ms | 1612 KB | Output is correct |
12 | Correct | 36 ms | 1612 KB | Output is correct |
13 | Correct | 28 ms | 1612 KB | Output is correct |
14 | Correct | 28 ms | 1612 KB | Output is correct |
15 | Correct | 29 ms | 1612 KB | Output is correct |
16 | Correct | 32 ms | 1612 KB | Output is correct |
17 | Correct | 19 ms | 1612 KB | Output is correct |
18 | Correct | 25 ms | 1612 KB | Output is correct |
19 | Correct | 26 ms | 1612 KB | Output is correct |
20 | Correct | 28 ms | 1612 KB | Output is correct |
21 | Correct | 67 ms | 1756 KB | Output is correct |
22 | Correct | 68 ms | 1756 KB | Output is correct |
23 | Correct | 47 ms | 1756 KB | Output is correct |
24 | Correct | 89 ms | 1888 KB | Output is correct |
25 | Correct | 88 ms | 2120 KB | Output is correct |
26 | Correct | 102 ms | 2120 KB | Output is correct |
27 | Correct | 103 ms | 2204 KB | Output is correct |
28 | Correct | 95 ms | 2204 KB | Output is correct |
29 | Correct | 89 ms | 2220 KB | Output is correct |
30 | Correct | 86 ms | 2220 KB | Output is correct |
31 | Correct | 95 ms | 2220 KB | Output is correct |
32 | Correct | 134 ms | 2220 KB | Output is correct |
33 | Correct | 91 ms | 2352 KB | Output is correct |
34 | Correct | 88 ms | 2352 KB | Output is correct |
35 | Correct | 88 ms | 2352 KB | Output is correct |
36 | Correct | 93 ms | 2352 KB | Output is correct |
37 | Correct | 222 ms | 2620 KB | Output is correct |
38 | Correct | 216 ms | 2696 KB | Output is correct |
39 | Correct | 244 ms | 4924 KB | Output is correct |
40 | Correct | 355 ms | 4924 KB | Output is correct |
41 | Correct | 260 ms | 5692 KB | Output is correct |
42 | Correct | 303 ms | 5692 KB | Output is correct |
43 | Correct | 357 ms | 5692 KB | Output is correct |
44 | Correct | 332 ms | 5692 KB | Output is correct |
45 | Correct | 386 ms | 5692 KB | Output is correct |
46 | Correct | 240 ms | 5692 KB | Output is correct |
47 | Correct | 318 ms | 5692 KB | Output is correct |
48 | Correct | 309 ms | 5692 KB | Output is correct |
49 | Correct | 280 ms | 5692 KB | Output is correct |
50 | Correct | 309 ms | 5692 KB | Output is correct |
51 | Correct | 72 ms | 5692 KB | Output is correct |
52 | Correct | 380 ms | 5692 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
10 | Correct | 28 ms | 1612 KB | Output is correct |
11 | Correct | 33 ms | 1612 KB | Output is correct |
12 | Correct | 36 ms | 1612 KB | Output is correct |
13 | Correct | 28 ms | 1612 KB | Output is correct |
14 | Correct | 28 ms | 1612 KB | Output is correct |
15 | Correct | 29 ms | 1612 KB | Output is correct |
16 | Correct | 32 ms | 1612 KB | Output is correct |
17 | Correct | 19 ms | 1612 KB | Output is correct |
18 | Correct | 25 ms | 1612 KB | Output is correct |
19 | Correct | 26 ms | 1612 KB | Output is correct |
20 | Correct | 28 ms | 1612 KB | Output is correct |
21 | Correct | 67 ms | 1756 KB | Output is correct |
22 | Correct | 68 ms | 1756 KB | Output is correct |
23 | Correct | 47 ms | 1756 KB | Output is correct |
24 | Correct | 89 ms | 1888 KB | Output is correct |
25 | Correct | 88 ms | 2120 KB | Output is correct |
26 | Correct | 102 ms | 2120 KB | Output is correct |
27 | Correct | 103 ms | 2204 KB | Output is correct |
28 | Correct | 95 ms | 2204 KB | Output is correct |
29 | Correct | 89 ms | 2220 KB | Output is correct |
30 | Correct | 86 ms | 2220 KB | Output is correct |
31 | Correct | 95 ms | 2220 KB | Output is correct |
32 | Correct | 134 ms | 2220 KB | Output is correct |
33 | Correct | 91 ms | 2352 KB | Output is correct |
34 | Correct | 88 ms | 2352 KB | Output is correct |
35 | Correct | 88 ms | 2352 KB | Output is correct |
36 | Correct | 93 ms | 2352 KB | Output is correct |
37 | Correct | 222 ms | 2620 KB | Output is correct |
38 | Correct | 216 ms | 2696 KB | Output is correct |
39 | Correct | 244 ms | 4924 KB | Output is correct |
40 | Correct | 355 ms | 4924 KB | Output is correct |
41 | Correct | 260 ms | 5692 KB | Output is correct |
42 | Correct | 303 ms | 5692 KB | Output is correct |
43 | Correct | 357 ms | 5692 KB | Output is correct |
44 | Correct | 332 ms | 5692 KB | Output is correct |
45 | Correct | 386 ms | 5692 KB | Output is correct |
46 | Correct | 240 ms | 5692 KB | Output is correct |
47 | Correct | 318 ms | 5692 KB | Output is correct |
48 | Correct | 309 ms | 5692 KB | Output is correct |
49 | Correct | 280 ms | 5692 KB | Output is correct |
50 | Correct | 309 ms | 5692 KB | Output is correct |
51 | Correct | 72 ms | 5692 KB | Output is correct |
52 | Correct | 380 ms | 5692 KB | Output is correct |
53 | Correct | 411 ms | 5692 KB | Output is correct |
54 | Correct | 476 ms | 5692 KB | Output is correct |
55 | Correct | 601 ms | 7608 KB | Output is correct |
56 | Correct | 466 ms | 7608 KB | Output is correct |
57 | Correct | 703 ms | 7736 KB | Output is correct |
58 | Correct | 477 ms | 7736 KB | Output is correct |
59 | Correct | 594 ms | 7736 KB | Output is correct |
60 | Correct | 101 ms | 7736 KB | Output is correct |
61 | Correct | 611 ms | 7736 KB | Output is correct |
62 | Correct | 546 ms | 7736 KB | Output is correct |
63 | Correct | 590 ms | 7736 KB | Output is correct |
64 | Correct | 562 ms | 7736 KB | Output is correct |
65 | Correct | 290 ms | 7736 KB | Output is correct |
66 | Correct | 338 ms | 7736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1272 KB | Output is correct |
2 | Correct | 9 ms | 1396 KB | Output is correct |
3 | Correct | 4 ms | 1396 KB | Output is correct |
4 | Correct | 7 ms | 1488 KB | Output is correct |
5 | Correct | 13 ms | 1488 KB | Output is correct |
6 | Correct | 10 ms | 1508 KB | Output is correct |
7 | Correct | 8 ms | 1568 KB | Output is correct |
8 | Correct | 14 ms | 1612 KB | Output is correct |
9 | Correct | 12 ms | 1612 KB | Output is correct |
10 | Correct | 28 ms | 1612 KB | Output is correct |
11 | Correct | 33 ms | 1612 KB | Output is correct |
12 | Correct | 36 ms | 1612 KB | Output is correct |
13 | Correct | 28 ms | 1612 KB | Output is correct |
14 | Correct | 28 ms | 1612 KB | Output is correct |
15 | Correct | 29 ms | 1612 KB | Output is correct |
16 | Correct | 32 ms | 1612 KB | Output is correct |
17 | Correct | 19 ms | 1612 KB | Output is correct |
18 | Correct | 25 ms | 1612 KB | Output is correct |
19 | Correct | 26 ms | 1612 KB | Output is correct |
20 | Correct | 28 ms | 1612 KB | Output is correct |
21 | Correct | 67 ms | 1756 KB | Output is correct |
22 | Correct | 68 ms | 1756 KB | Output is correct |
23 | Correct | 47 ms | 1756 KB | Output is correct |
24 | Correct | 89 ms | 1888 KB | Output is correct |
25 | Correct | 88 ms | 2120 KB | Output is correct |
26 | Correct | 102 ms | 2120 KB | Output is correct |
27 | Correct | 103 ms | 2204 KB | Output is correct |
28 | Correct | 95 ms | 2204 KB | Output is correct |
29 | Correct | 89 ms | 2220 KB | Output is correct |
30 | Correct | 86 ms | 2220 KB | Output is correct |
31 | Correct | 95 ms | 2220 KB | Output is correct |
32 | Correct | 134 ms | 2220 KB | Output is correct |
33 | Correct | 91 ms | 2352 KB | Output is correct |
34 | Correct | 88 ms | 2352 KB | Output is correct |
35 | Correct | 88 ms | 2352 KB | Output is correct |
36 | Correct | 93 ms | 2352 KB | Output is correct |
37 | Correct | 222 ms | 2620 KB | Output is correct |
38 | Correct | 216 ms | 2696 KB | Output is correct |
39 | Correct | 244 ms | 4924 KB | Output is correct |
40 | Correct | 355 ms | 4924 KB | Output is correct |
41 | Correct | 260 ms | 5692 KB | Output is correct |
42 | Correct | 303 ms | 5692 KB | Output is correct |
43 | Correct | 357 ms | 5692 KB | Output is correct |
44 | Correct | 332 ms | 5692 KB | Output is correct |
45 | Correct | 386 ms | 5692 KB | Output is correct |
46 | Correct | 240 ms | 5692 KB | Output is correct |
47 | Correct | 318 ms | 5692 KB | Output is correct |
48 | Correct | 309 ms | 5692 KB | Output is correct |
49 | Correct | 280 ms | 5692 KB | Output is correct |
50 | Correct | 309 ms | 5692 KB | Output is correct |
51 | Correct | 72 ms | 5692 KB | Output is correct |
52 | Correct | 380 ms | 5692 KB | Output is correct |
53 | Correct | 411 ms | 5692 KB | Output is correct |
54 | Correct | 476 ms | 5692 KB | Output is correct |
55 | Correct | 601 ms | 7608 KB | Output is correct |
56 | Correct | 466 ms | 7608 KB | Output is correct |
57 | Correct | 703 ms | 7736 KB | Output is correct |
58 | Correct | 477 ms | 7736 KB | Output is correct |
59 | Correct | 594 ms | 7736 KB | Output is correct |
60 | Correct | 101 ms | 7736 KB | Output is correct |
61 | Correct | 611 ms | 7736 KB | Output is correct |
62 | Correct | 546 ms | 7736 KB | Output is correct |
63 | Correct | 590 ms | 7736 KB | Output is correct |
64 | Correct | 562 ms | 7736 KB | Output is correct |
65 | Correct | 290 ms | 7736 KB | Output is correct |
66 | Correct | 338 ms | 7736 KB | Output is correct |
67 | Correct | 653 ms | 7736 KB | Output is correct |
68 | Correct | 142 ms | 7736 KB | Output is correct |
69 | Execution timed out | 1078 ms | 12216 KB | Time limit exceeded |
70 | Halted | 0 ms | 0 KB | - |