# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
672187 | 2022-12-15T02:25:15 Z | ReLice | Bootfall (IZhO17_bootfall) | C++14 | 235 ms | 5752 KB |
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define ld long double #define int long long #define pb push_back #define sz size() #define fr first #define sc second void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll N=1e5+1; const ll inf=1e9+7; ll dp[250001],used[250001]; main(){ start(); ll n,k,i,j,b,mx=-1; cin >> n; vector <ll> ans; ll sum=0,a[n]; for (i=0;i<n;i++) { cin>>a[i]; sum+=a[i]; } dp[0]++; for(i=0;i<n;i++) for(j=sum;j-a[i]>=0;j--) dp[j]+=dp[j-a[i]]; if(!dp[sum/2] || sum%2) { cout<<0; exit(0); } for (i=0;i<n;i++) { ll cur=sum-a[i]; for(j=a[i];j<=sum;j++) { dp[j]-=dp[j-a[i]]; } for(ll j=0;j<=cur/2;j++){ if(dp[j])used[cur-j*2]++; } for(ll j=sum;j>=a[i];j--){ dp[j]+=dp[j-a[i]]; } } for(ll i=0;i<=sum;i++) { if(used[i]==n) ans.pb(i); } cout<<ans.sz<<'\n'; for (auto i : ans) cout<<i<<' '; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 3 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 332 KB | Output is correct |
31 | Correct | 2 ms | 468 KB | Output is correct |
32 | Correct | 2 ms | 468 KB | Output is correct |
33 | Correct | 3 ms | 460 KB | Output is correct |
34 | Correct | 3 ms | 464 KB | Output is correct |
35 | Correct | 3 ms | 464 KB | Output is correct |
36 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 3 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 332 KB | Output is correct |
31 | Correct | 2 ms | 468 KB | Output is correct |
32 | Correct | 2 ms | 468 KB | Output is correct |
33 | Correct | 3 ms | 460 KB | Output is correct |
34 | Correct | 3 ms | 464 KB | Output is correct |
35 | Correct | 3 ms | 464 KB | Output is correct |
36 | Correct | 1 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 900 KB | Output is correct |
38 | Correct | 9 ms | 940 KB | Output is correct |
39 | Correct | 31 ms | 1232 KB | Output is correct |
40 | Correct | 17 ms | 1100 KB | Output is correct |
41 | Correct | 39 ms | 1424 KB | Output is correct |
42 | Correct | 15 ms | 1100 KB | Output is correct |
43 | Correct | 27 ms | 1580 KB | Output is correct |
44 | Correct | 27 ms | 1668 KB | Output is correct |
45 | Correct | 29 ms | 1612 KB | Output is correct |
46 | Correct | 18 ms | 724 KB | Output is correct |
47 | Correct | 16 ms | 1104 KB | Output is correct |
48 | Correct | 32 ms | 1684 KB | Output is correct |
49 | Correct | 32 ms | 1408 KB | Output is correct |
50 | Correct | 17 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 2000 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 3 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 332 KB | Output is correct |
31 | Correct | 2 ms | 468 KB | Output is correct |
32 | Correct | 2 ms | 468 KB | Output is correct |
33 | Correct | 3 ms | 460 KB | Output is correct |
34 | Correct | 3 ms | 464 KB | Output is correct |
35 | Correct | 3 ms | 464 KB | Output is correct |
36 | Correct | 1 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 900 KB | Output is correct |
38 | Correct | 9 ms | 940 KB | Output is correct |
39 | Correct | 31 ms | 1232 KB | Output is correct |
40 | Correct | 17 ms | 1100 KB | Output is correct |
41 | Correct | 39 ms | 1424 KB | Output is correct |
42 | Correct | 15 ms | 1100 KB | Output is correct |
43 | Correct | 27 ms | 1580 KB | Output is correct |
44 | Correct | 27 ms | 1668 KB | Output is correct |
45 | Correct | 29 ms | 1612 KB | Output is correct |
46 | Correct | 18 ms | 724 KB | Output is correct |
47 | Correct | 16 ms | 1104 KB | Output is correct |
48 | Correct | 32 ms | 1684 KB | Output is correct |
49 | Correct | 32 ms | 1408 KB | Output is correct |
50 | Correct | 17 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 2000 KB | Output is correct |
53 | Correct | 26 ms | 1360 KB | Output is correct |
54 | Correct | 39 ms | 1664 KB | Output is correct |
55 | Correct | 81 ms | 2824 KB | Output is correct |
56 | Correct | 33 ms | 1616 KB | Output is correct |
57 | Correct | 85 ms | 2908 KB | Output is correct |
58 | Correct | 42 ms | 1800 KB | Output is correct |
59 | Correct | 51 ms | 2156 KB | Output is correct |
60 | Correct | 12 ms | 852 KB | Output is correct |
61 | Correct | 56 ms | 2296 KB | Output is correct |
62 | Correct | 57 ms | 2508 KB | Output is correct |
63 | Correct | 69 ms | 2708 KB | Output is correct |
64 | Correct | 67 ms | 2680 KB | Output is correct |
65 | Correct | 36 ms | 1088 KB | Output is correct |
66 | Correct | 34 ms | 1284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 3 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 332 KB | Output is correct |
31 | Correct | 2 ms | 468 KB | Output is correct |
32 | Correct | 2 ms | 468 KB | Output is correct |
33 | Correct | 3 ms | 460 KB | Output is correct |
34 | Correct | 3 ms | 464 KB | Output is correct |
35 | Correct | 3 ms | 464 KB | Output is correct |
36 | Correct | 1 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 900 KB | Output is correct |
38 | Correct | 9 ms | 940 KB | Output is correct |
39 | Correct | 31 ms | 1232 KB | Output is correct |
40 | Correct | 17 ms | 1100 KB | Output is correct |
41 | Correct | 39 ms | 1424 KB | Output is correct |
42 | Correct | 15 ms | 1100 KB | Output is correct |
43 | Correct | 27 ms | 1580 KB | Output is correct |
44 | Correct | 27 ms | 1668 KB | Output is correct |
45 | Correct | 29 ms | 1612 KB | Output is correct |
46 | Correct | 18 ms | 724 KB | Output is correct |
47 | Correct | 16 ms | 1104 KB | Output is correct |
48 | Correct | 32 ms | 1684 KB | Output is correct |
49 | Correct | 32 ms | 1408 KB | Output is correct |
50 | Correct | 17 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 2000 KB | Output is correct |
53 | Correct | 26 ms | 1360 KB | Output is correct |
54 | Correct | 39 ms | 1664 KB | Output is correct |
55 | Correct | 81 ms | 2824 KB | Output is correct |
56 | Correct | 33 ms | 1616 KB | Output is correct |
57 | Correct | 85 ms | 2908 KB | Output is correct |
58 | Correct | 42 ms | 1800 KB | Output is correct |
59 | Correct | 51 ms | 2156 KB | Output is correct |
60 | Correct | 12 ms | 852 KB | Output is correct |
61 | Correct | 56 ms | 2296 KB | Output is correct |
62 | Correct | 57 ms | 2508 KB | Output is correct |
63 | Correct | 69 ms | 2708 KB | Output is correct |
64 | Correct | 67 ms | 2680 KB | Output is correct |
65 | Correct | 36 ms | 1088 KB | Output is correct |
66 | Correct | 34 ms | 1284 KB | Output is correct |
67 | Correct | 61 ms | 2252 KB | Output is correct |
68 | Correct | 31 ms | 1228 KB | Output is correct |
69 | Correct | 205 ms | 5192 KB | Output is correct |
70 | Correct | 119 ms | 3340 KB | Output is correct |
71 | Correct | 118 ms | 3148 KB | Output is correct |
72 | Correct | 115 ms | 2276 KB | Output is correct |
73 | Correct | 120 ms | 2272 KB | Output is correct |
74 | Correct | 208 ms | 5476 KB | Output is correct |
75 | Correct | 162 ms | 4320 KB | Output is correct |
76 | Correct | 235 ms | 5640 KB | Output is correct |
77 | Correct | 227 ms | 5752 KB | Output is correct |