# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
344749 | 2021-01-06T13:35:12 Z | fixikmila | Bootfall (IZhO17_bootfall) | C++14 | 422 ms | 5992 KB |
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; typedef pair<ll,ll>pll; typedef long double ld; ll bin_pow(ll a,ll b){ if(b==0)return 1; if(b%2==0){ ll t=bin_pow(a,b/2); return t*t%MOD; } else return a*bin_pow(a,b-1)%MOD; } ll dp[250001],d[250001]; int main() { //freopen("stones.in","r",stdin); //freopen("stones.out","w",stdout); ios::sync_with_stdio(false); cin.tie(0); ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN; cin>>n; vector<ll>a(n); dp[0]=1; for(int i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; for(int j=sum;j>=a[i];j--)dp[j]+=dp[j-a[i]];// с конца т к к более мелким еще не успели прибавить } if(sum%2||!dp[sum/2]){ cout<<0; return 0; } for(int i=0;i<n;i++){ for(int j=a[i];j<=sum;j++)dp[j]-=dp[j-a[i]];//сначала, тк чтобы когда мы отнимали от j-того, от j-a[i]-го уже было отнято то, что было сделано с помощью а_и sum-=a[i]; for(int j=0;j<=500*500;j++){ if((sum+j)%2||!dp[(sum+j)/2])d[j]=1; } sum+=a[i]; for(int j=sum;j>=a[i];j--)dp[j]+=dp[j-a[i]]; } vector<ll>c; for(int i=0;i<=250000;i++){ if(d[i])continue; c.push_back(i); } cout<<c.size()<<"\n"; for(auto u : c)cout<<u<<" "; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
10 | Correct | 13 ms | 2284 KB | Output is correct |
11 | Correct | 13 ms | 2284 KB | Output is correct |
12 | Correct | 13 ms | 2284 KB | Output is correct |
13 | Correct | 11 ms | 2284 KB | Output is correct |
14 | Correct | 12 ms | 2284 KB | Output is correct |
15 | Correct | 12 ms | 2284 KB | Output is correct |
16 | Correct | 13 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 11 ms | 2284 KB | Output is correct |
19 | Correct | 12 ms | 2284 KB | Output is correct |
20 | Correct | 13 ms | 2284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
10 | Correct | 13 ms | 2284 KB | Output is correct |
11 | Correct | 13 ms | 2284 KB | Output is correct |
12 | Correct | 13 ms | 2284 KB | Output is correct |
13 | Correct | 11 ms | 2284 KB | Output is correct |
14 | Correct | 12 ms | 2284 KB | Output is correct |
15 | Correct | 12 ms | 2284 KB | Output is correct |
16 | Correct | 13 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 11 ms | 2284 KB | Output is correct |
19 | Correct | 12 ms | 2284 KB | Output is correct |
20 | Correct | 13 ms | 2284 KB | Output is correct |
21 | Correct | 25 ms | 2412 KB | Output is correct |
22 | Correct | 30 ms | 2412 KB | Output is correct |
23 | Correct | 22 ms | 2412 KB | Output is correct |
24 | Correct | 37 ms | 2412 KB | Output is correct |
25 | Correct | 37 ms | 2412 KB | Output is correct |
26 | Correct | 41 ms | 2412 KB | Output is correct |
27 | Correct | 39 ms | 2412 KB | Output is correct |
28 | Correct | 41 ms | 2540 KB | Output is correct |
29 | Correct | 41 ms | 2412 KB | Output is correct |
30 | Correct | 39 ms | 2284 KB | Output is correct |
31 | Correct | 39 ms | 2432 KB | Output is correct |
32 | Correct | 38 ms | 2412 KB | Output is correct |
33 | Correct | 40 ms | 2412 KB | Output is correct |
34 | Correct | 39 ms | 2432 KB | Output is correct |
35 | Correct | 43 ms | 2540 KB | Output is correct |
36 | Correct | 39 ms | 2412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
10 | Correct | 13 ms | 2284 KB | Output is correct |
11 | Correct | 13 ms | 2284 KB | Output is correct |
12 | Correct | 13 ms | 2284 KB | Output is correct |
13 | Correct | 11 ms | 2284 KB | Output is correct |
14 | Correct | 12 ms | 2284 KB | Output is correct |
15 | Correct | 12 ms | 2284 KB | Output is correct |
16 | Correct | 13 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 11 ms | 2284 KB | Output is correct |
19 | Correct | 12 ms | 2284 KB | Output is correct |
20 | Correct | 13 ms | 2284 KB | Output is correct |
21 | Correct | 25 ms | 2412 KB | Output is correct |
22 | Correct | 30 ms | 2412 KB | Output is correct |
23 | Correct | 22 ms | 2412 KB | Output is correct |
24 | Correct | 37 ms | 2412 KB | Output is correct |
25 | Correct | 37 ms | 2412 KB | Output is correct |
26 | Correct | 41 ms | 2412 KB | Output is correct |
27 | Correct | 39 ms | 2412 KB | Output is correct |
28 | Correct | 41 ms | 2540 KB | Output is correct |
29 | Correct | 41 ms | 2412 KB | Output is correct |
30 | Correct | 39 ms | 2284 KB | Output is correct |
31 | Correct | 39 ms | 2432 KB | Output is correct |
32 | Correct | 38 ms | 2412 KB | Output is correct |
33 | Correct | 40 ms | 2412 KB | Output is correct |
34 | Correct | 39 ms | 2432 KB | Output is correct |
35 | Correct | 43 ms | 2540 KB | Output is correct |
36 | Correct | 39 ms | 2412 KB | Output is correct |
37 | Correct | 82 ms | 2796 KB | Output is correct |
38 | Correct | 82 ms | 2668 KB | Output is correct |
39 | Correct | 127 ms | 2844 KB | Output is correct |
40 | Correct | 120 ms | 2924 KB | Output is correct |
41 | Correct | 140 ms | 2936 KB | Output is correct |
42 | Correct | 107 ms | 2924 KB | Output is correct |
43 | Correct | 120 ms | 3196 KB | Output is correct |
44 | Correct | 118 ms | 3180 KB | Output is correct |
45 | Correct | 119 ms | 3308 KB | Output is correct |
46 | Correct | 114 ms | 2540 KB | Output is correct |
47 | Correct | 111 ms | 2872 KB | Output is correct |
48 | Correct | 123 ms | 3200 KB | Output is correct |
49 | Correct | 122 ms | 2924 KB | Output is correct |
50 | Correct | 107 ms | 2924 KB | Output is correct |
51 | Correct | 3 ms | 620 KB | Output is correct |
52 | Correct | 136 ms | 3436 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
10 | Correct | 13 ms | 2284 KB | Output is correct |
11 | Correct | 13 ms | 2284 KB | Output is correct |
12 | Correct | 13 ms | 2284 KB | Output is correct |
13 | Correct | 11 ms | 2284 KB | Output is correct |
14 | Correct | 12 ms | 2284 KB | Output is correct |
15 | Correct | 12 ms | 2284 KB | Output is correct |
16 | Correct | 13 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 11 ms | 2284 KB | Output is correct |
19 | Correct | 12 ms | 2284 KB | Output is correct |
20 | Correct | 13 ms | 2284 KB | Output is correct |
21 | Correct | 25 ms | 2412 KB | Output is correct |
22 | Correct | 30 ms | 2412 KB | Output is correct |
23 | Correct | 22 ms | 2412 KB | Output is correct |
24 | Correct | 37 ms | 2412 KB | Output is correct |
25 | Correct | 37 ms | 2412 KB | Output is correct |
26 | Correct | 41 ms | 2412 KB | Output is correct |
27 | Correct | 39 ms | 2412 KB | Output is correct |
28 | Correct | 41 ms | 2540 KB | Output is correct |
29 | Correct | 41 ms | 2412 KB | Output is correct |
30 | Correct | 39 ms | 2284 KB | Output is correct |
31 | Correct | 39 ms | 2432 KB | Output is correct |
32 | Correct | 38 ms | 2412 KB | Output is correct |
33 | Correct | 40 ms | 2412 KB | Output is correct |
34 | Correct | 39 ms | 2432 KB | Output is correct |
35 | Correct | 43 ms | 2540 KB | Output is correct |
36 | Correct | 39 ms | 2412 KB | Output is correct |
37 | Correct | 82 ms | 2796 KB | Output is correct |
38 | Correct | 82 ms | 2668 KB | Output is correct |
39 | Correct | 127 ms | 2844 KB | Output is correct |
40 | Correct | 120 ms | 2924 KB | Output is correct |
41 | Correct | 140 ms | 2936 KB | Output is correct |
42 | Correct | 107 ms | 2924 KB | Output is correct |
43 | Correct | 120 ms | 3196 KB | Output is correct |
44 | Correct | 118 ms | 3180 KB | Output is correct |
45 | Correct | 119 ms | 3308 KB | Output is correct |
46 | Correct | 114 ms | 2540 KB | Output is correct |
47 | Correct | 111 ms | 2872 KB | Output is correct |
48 | Correct | 123 ms | 3200 KB | Output is correct |
49 | Correct | 122 ms | 2924 KB | Output is correct |
50 | Correct | 107 ms | 2924 KB | Output is correct |
51 | Correct | 3 ms | 620 KB | Output is correct |
52 | Correct | 136 ms | 3436 KB | Output is correct |
53 | Correct | 136 ms | 3180 KB | Output is correct |
54 | Correct | 166 ms | 3308 KB | Output is correct |
55 | Correct | 207 ms | 4072 KB | Output is correct |
56 | Correct | 147 ms | 3308 KB | Output is correct |
57 | Correct | 212 ms | 4072 KB | Output is correct |
58 | Correct | 171 ms | 3308 KB | Output is correct |
59 | Correct | 178 ms | 3564 KB | Output is correct |
60 | Correct | 7 ms | 876 KB | Output is correct |
61 | Correct | 188 ms | 3688 KB | Output is correct |
62 | Correct | 179 ms | 3816 KB | Output is correct |
63 | Correct | 181 ms | 3944 KB | Output is correct |
64 | Correct | 179 ms | 4056 KB | Output is correct |
65 | Correct | 148 ms | 2668 KB | Output is correct |
66 | Correct | 147 ms | 2924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2284 KB | Output is correct |
2 | Correct | 4 ms | 2284 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 2284 KB | Output is correct |
5 | Correct | 6 ms | 2284 KB | Output is correct |
6 | Correct | 5 ms | 2284 KB | Output is correct |
7 | Correct | 4 ms | 2284 KB | Output is correct |
8 | Correct | 6 ms | 2284 KB | Output is correct |
9 | Correct | 5 ms | 2284 KB | Output is correct |
10 | Correct | 13 ms | 2284 KB | Output is correct |
11 | Correct | 13 ms | 2284 KB | Output is correct |
12 | Correct | 13 ms | 2284 KB | Output is correct |
13 | Correct | 11 ms | 2284 KB | Output is correct |
14 | Correct | 12 ms | 2284 KB | Output is correct |
15 | Correct | 12 ms | 2284 KB | Output is correct |
16 | Correct | 13 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 11 ms | 2284 KB | Output is correct |
19 | Correct | 12 ms | 2284 KB | Output is correct |
20 | Correct | 13 ms | 2284 KB | Output is correct |
21 | Correct | 25 ms | 2412 KB | Output is correct |
22 | Correct | 30 ms | 2412 KB | Output is correct |
23 | Correct | 22 ms | 2412 KB | Output is correct |
24 | Correct | 37 ms | 2412 KB | Output is correct |
25 | Correct | 37 ms | 2412 KB | Output is correct |
26 | Correct | 41 ms | 2412 KB | Output is correct |
27 | Correct | 39 ms | 2412 KB | Output is correct |
28 | Correct | 41 ms | 2540 KB | Output is correct |
29 | Correct | 41 ms | 2412 KB | Output is correct |
30 | Correct | 39 ms | 2284 KB | Output is correct |
31 | Correct | 39 ms | 2432 KB | Output is correct |
32 | Correct | 38 ms | 2412 KB | Output is correct |
33 | Correct | 40 ms | 2412 KB | Output is correct |
34 | Correct | 39 ms | 2432 KB | Output is correct |
35 | Correct | 43 ms | 2540 KB | Output is correct |
36 | Correct | 39 ms | 2412 KB | Output is correct |
37 | Correct | 82 ms | 2796 KB | Output is correct |
38 | Correct | 82 ms | 2668 KB | Output is correct |
39 | Correct | 127 ms | 2844 KB | Output is correct |
40 | Correct | 120 ms | 2924 KB | Output is correct |
41 | Correct | 140 ms | 2936 KB | Output is correct |
42 | Correct | 107 ms | 2924 KB | Output is correct |
43 | Correct | 120 ms | 3196 KB | Output is correct |
44 | Correct | 118 ms | 3180 KB | Output is correct |
45 | Correct | 119 ms | 3308 KB | Output is correct |
46 | Correct | 114 ms | 2540 KB | Output is correct |
47 | Correct | 111 ms | 2872 KB | Output is correct |
48 | Correct | 123 ms | 3200 KB | Output is correct |
49 | Correct | 122 ms | 2924 KB | Output is correct |
50 | Correct | 107 ms | 2924 KB | Output is correct |
51 | Correct | 3 ms | 620 KB | Output is correct |
52 | Correct | 136 ms | 3436 KB | Output is correct |
53 | Correct | 136 ms | 3180 KB | Output is correct |
54 | Correct | 166 ms | 3308 KB | Output is correct |
55 | Correct | 207 ms | 4072 KB | Output is correct |
56 | Correct | 147 ms | 3308 KB | Output is correct |
57 | Correct | 212 ms | 4072 KB | Output is correct |
58 | Correct | 171 ms | 3308 KB | Output is correct |
59 | Correct | 178 ms | 3564 KB | Output is correct |
60 | Correct | 7 ms | 876 KB | Output is correct |
61 | Correct | 188 ms | 3688 KB | Output is correct |
62 | Correct | 179 ms | 3816 KB | Output is correct |
63 | Correct | 181 ms | 3944 KB | Output is correct |
64 | Correct | 179 ms | 4056 KB | Output is correct |
65 | Correct | 148 ms | 2668 KB | Output is correct |
66 | Correct | 147 ms | 2924 KB | Output is correct |
67 | Correct | 206 ms | 3628 KB | Output is correct |
68 | Correct | 19 ms | 1260 KB | Output is correct |
69 | Correct | 391 ms | 5608 KB | Output is correct |
70 | Correct | 309 ms | 4388 KB | Output is correct |
71 | Correct | 305 ms | 4332 KB | Output is correct |
72 | Correct | 302 ms | 3436 KB | Output is correct |
73 | Correct | 301 ms | 3308 KB | Output is correct |
74 | Correct | 401 ms | 5736 KB | Output is correct |
75 | Correct | 350 ms | 5096 KB | Output is correct |
76 | Correct | 422 ms | 5808 KB | Output is correct |
77 | Correct | 413 ms | 5992 KB | Output is correct |