# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
672422 | 2022-12-16T03:46:54 Z | Cutebol | Bootfall (IZhO17_bootfall) | C++17 | 249 ms | 5704 KB |
#include <bits/stdc++.h> using namespace std; void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} #define Scaramouche ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0); #define int long long #define itn int #define endl "\n" #define ff first #define ss second const int N = 2e5 + 5 ; const int mod = 1e9 + 7 ; const int inf = 1e12 ; int n , sum ; int a[250005] , dp[250005] , vis[250005] ; void solve(){ cin >> n ; for ( int i = 0 ; i < n ; i ++ ){ cin >> a[i] ; sum += a[i] ; } dp[0] ++ ; for ( int i = 0 ; i < n ; i ++ ) for( int j = sum ; j - a[i] >= 0 ; j -- ) dp[j] += dp[j-a[i]] ; if ( !dp[sum/2] || sum % 2 ){ cout << 0 ; return ; } for ( int i = 0 ; i < n ; i ++ ){ int cur = sum - a[i] ; for ( int j = a[i] ; j <= sum ; j ++ ) dp[j] -= dp[j-a[i]] ; for ( int j = 0 ; j <= cur/2 ; j ++ ) if ( dp[j] ) vis[cur-j*2] ++ ; for ( int j = sum ; j >= a[i] ;j -- ) dp[j] += dp[j-a[i]] ; }vector <int> ans ; for ( int i = 0 ; i < sum + 1 ; i ++ ) if ( vis[i] == n ) ans.push_back(i) ; cout << ans.size() << '\n' ; for ( auto ti : ans ) cout << ti << ' ' ; } signed main(){ // fopn("blocks") ; Scaramouche ; int t = 1 ; // cin >> t ; while ( t -- ) solve() ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 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 | 336 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 3 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 2 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 468 KB | Output is correct |
32 | Correct | 3 ms | 512 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 3 ms | 468 KB | Output is correct |
35 | Correct | 4 ms | 468 KB | Output is correct |
36 | Correct | 2 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 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 | 336 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 3 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 2 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 468 KB | Output is correct |
32 | Correct | 3 ms | 512 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 3 ms | 468 KB | Output is correct |
35 | Correct | 4 ms | 468 KB | Output is correct |
36 | Correct | 2 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 13 ms | 852 KB | Output is correct |
39 | Correct | 36 ms | 1364 KB | Output is correct |
40 | Correct | 20 ms | 1104 KB | Output is correct |
41 | Correct | 43 ms | 1424 KB | Output is correct |
42 | Correct | 18 ms | 1096 KB | Output is correct |
43 | Correct | 30 ms | 1616 KB | Output is correct |
44 | Correct | 33 ms | 1604 KB | Output is correct |
45 | Correct | 32 ms | 1624 KB | Output is correct |
46 | Correct | 19 ms | 836 KB | Output is correct |
47 | Correct | 18 ms | 1100 KB | Output is correct |
48 | Correct | 34 ms | 1684 KB | Output is correct |
49 | Correct | 34 ms | 1356 KB | Output is correct |
50 | Correct | 19 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 42 ms | 1944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 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 | 336 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 3 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 2 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 468 KB | Output is correct |
32 | Correct | 3 ms | 512 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 3 ms | 468 KB | Output is correct |
35 | Correct | 4 ms | 468 KB | Output is correct |
36 | Correct | 2 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 13 ms | 852 KB | Output is correct |
39 | Correct | 36 ms | 1364 KB | Output is correct |
40 | Correct | 20 ms | 1104 KB | Output is correct |
41 | Correct | 43 ms | 1424 KB | Output is correct |
42 | Correct | 18 ms | 1096 KB | Output is correct |
43 | Correct | 30 ms | 1616 KB | Output is correct |
44 | Correct | 33 ms | 1604 KB | Output is correct |
45 | Correct | 32 ms | 1624 KB | Output is correct |
46 | Correct | 19 ms | 836 KB | Output is correct |
47 | Correct | 18 ms | 1100 KB | Output is correct |
48 | Correct | 34 ms | 1684 KB | Output is correct |
49 | Correct | 34 ms | 1356 KB | Output is correct |
50 | Correct | 19 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 42 ms | 1944 KB | Output is correct |
53 | Correct | 33 ms | 1444 KB | Output is correct |
54 | Correct | 41 ms | 1688 KB | Output is correct |
55 | Correct | 85 ms | 2864 KB | Output is correct |
56 | Correct | 37 ms | 1732 KB | Output is correct |
57 | Correct | 84 ms | 2928 KB | Output is correct |
58 | Correct | 60 ms | 1796 KB | Output is correct |
59 | Correct | 61 ms | 2128 KB | Output is correct |
60 | Correct | 14 ms | 852 KB | Output is correct |
61 | Correct | 62 ms | 2380 KB | Output is correct |
62 | Correct | 68 ms | 2592 KB | Output is correct |
63 | Correct | 74 ms | 2812 KB | Output is correct |
64 | Correct | 66 ms | 2668 KB | Output is correct |
65 | Correct | 34 ms | 1104 KB | Output is correct |
66 | Correct | 35 ms | 1292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 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 | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 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 | 336 KB | Output is correct |
24 | Correct | 2 ms | 468 KB | Output is correct |
25 | Correct | 2 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 3 ms | 468 KB | Output is correct |
28 | Correct | 3 ms | 468 KB | Output is correct |
29 | Correct | 2 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 468 KB | Output is correct |
32 | Correct | 3 ms | 512 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 3 ms | 468 KB | Output is correct |
35 | Correct | 4 ms | 468 KB | Output is correct |
36 | Correct | 2 ms | 468 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 13 ms | 852 KB | Output is correct |
39 | Correct | 36 ms | 1364 KB | Output is correct |
40 | Correct | 20 ms | 1104 KB | Output is correct |
41 | Correct | 43 ms | 1424 KB | Output is correct |
42 | Correct | 18 ms | 1096 KB | Output is correct |
43 | Correct | 30 ms | 1616 KB | Output is correct |
44 | Correct | 33 ms | 1604 KB | Output is correct |
45 | Correct | 32 ms | 1624 KB | Output is correct |
46 | Correct | 19 ms | 836 KB | Output is correct |
47 | Correct | 18 ms | 1100 KB | Output is correct |
48 | Correct | 34 ms | 1684 KB | Output is correct |
49 | Correct | 34 ms | 1356 KB | Output is correct |
50 | Correct | 19 ms | 1108 KB | Output is correct |
51 | Correct | 5 ms | 468 KB | Output is correct |
52 | Correct | 42 ms | 1944 KB | Output is correct |
53 | Correct | 33 ms | 1444 KB | Output is correct |
54 | Correct | 41 ms | 1688 KB | Output is correct |
55 | Correct | 85 ms | 2864 KB | Output is correct |
56 | Correct | 37 ms | 1732 KB | Output is correct |
57 | Correct | 84 ms | 2928 KB | Output is correct |
58 | Correct | 60 ms | 1796 KB | Output is correct |
59 | Correct | 61 ms | 2128 KB | Output is correct |
60 | Correct | 14 ms | 852 KB | Output is correct |
61 | Correct | 62 ms | 2380 KB | Output is correct |
62 | Correct | 68 ms | 2592 KB | Output is correct |
63 | Correct | 74 ms | 2812 KB | Output is correct |
64 | Correct | 66 ms | 2668 KB | Output is correct |
65 | Correct | 34 ms | 1104 KB | Output is correct |
66 | Correct | 35 ms | 1292 KB | Output is correct |
67 | Correct | 69 ms | 2256 KB | Output is correct |
68 | Correct | 32 ms | 1292 KB | Output is correct |
69 | Correct | 217 ms | 5160 KB | Output is correct |
70 | Correct | 135 ms | 3252 KB | Output is correct |
71 | Correct | 149 ms | 3156 KB | Output is correct |
72 | Correct | 138 ms | 2208 KB | Output is correct |
73 | Correct | 125 ms | 2336 KB | Output is correct |
74 | Correct | 232 ms | 5592 KB | Output is correct |
75 | Correct | 181 ms | 4376 KB | Output is correct |
76 | Correct | 249 ms | 5644 KB | Output is correct |
77 | Correct | 248 ms | 5704 KB | Output is correct |