# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
672421 | 2022-12-16T03:45:19 Z | Cutebol | Bootfall (IZhO17_bootfall) | C++17 | 83 ms | 3752 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[N] , dp[N] , vis[N] ; 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 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 | 340 KB | Output is correct |
24 | Correct | 3 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 2 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 | 2 ms | 420 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 2 ms | 468 KB | Output is correct |
35 | Correct | 2 ms | 468 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 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 | 340 KB | Output is correct |
24 | Correct | 3 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 2 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 | 2 ms | 420 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 2 ms | 468 KB | Output is correct |
35 | Correct | 2 ms | 468 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 9 ms | 852 KB | Output is correct |
39 | Correct | 30 ms | 1236 KB | Output is correct |
40 | Correct | 17 ms | 1084 KB | Output is correct |
41 | Correct | 37 ms | 1400 KB | Output is correct |
42 | Correct | 16 ms | 1052 KB | Output is correct |
43 | Correct | 27 ms | 1560 KB | Output is correct |
44 | Correct | 28 ms | 1644 KB | Output is correct |
45 | Correct | 28 ms | 1608 KB | Output is correct |
46 | Correct | 16 ms | 724 KB | Output is correct |
47 | Correct | 18 ms | 1108 KB | Output is correct |
48 | Correct | 36 ms | 1620 KB | Output is correct |
49 | Correct | 31 ms | 1272 KB | Output is correct |
50 | Correct | 18 ms | 1084 KB | Output is correct |
51 | Correct | 6 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 1912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 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 | 340 KB | Output is correct |
24 | Correct | 3 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 2 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 | 2 ms | 420 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 2 ms | 468 KB | Output is correct |
35 | Correct | 2 ms | 468 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 9 ms | 852 KB | Output is correct |
39 | Correct | 30 ms | 1236 KB | Output is correct |
40 | Correct | 17 ms | 1084 KB | Output is correct |
41 | Correct | 37 ms | 1400 KB | Output is correct |
42 | Correct | 16 ms | 1052 KB | Output is correct |
43 | Correct | 27 ms | 1560 KB | Output is correct |
44 | Correct | 28 ms | 1644 KB | Output is correct |
45 | Correct | 28 ms | 1608 KB | Output is correct |
46 | Correct | 16 ms | 724 KB | Output is correct |
47 | Correct | 18 ms | 1108 KB | Output is correct |
48 | Correct | 36 ms | 1620 KB | Output is correct |
49 | Correct | 31 ms | 1272 KB | Output is correct |
50 | Correct | 18 ms | 1084 KB | Output is correct |
51 | Correct | 6 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 1912 KB | Output is correct |
53 | Correct | 26 ms | 1416 KB | Output is correct |
54 | Correct | 39 ms | 1696 KB | Output is correct |
55 | Correct | 76 ms | 2756 KB | Output is correct |
56 | Correct | 35 ms | 1696 KB | Output is correct |
57 | Correct | 83 ms | 2880 KB | Output is correct |
58 | Correct | 40 ms | 1736 KB | Output is correct |
59 | Correct | 55 ms | 2144 KB | Output is correct |
60 | Correct | 11 ms | 724 KB | Output is correct |
61 | Correct | 64 ms | 2400 KB | Output is correct |
62 | Correct | 59 ms | 2548 KB | Output is correct |
63 | Correct | 64 ms | 2684 KB | Output is correct |
64 | Correct | 62 ms | 2656 KB | Output is correct |
65 | Correct | 31 ms | 1072 KB | Output is correct |
66 | Correct | 33 ms | 1148 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 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 | 340 KB | Output is correct |
24 | Correct | 3 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 468 KB | Output is correct |
26 | Correct | 3 ms | 468 KB | Output is correct |
27 | Correct | 2 ms | 468 KB | Output is correct |
28 | Correct | 2 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 | 2 ms | 420 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 3 ms | 468 KB | Output is correct |
34 | Correct | 2 ms | 468 KB | Output is correct |
35 | Correct | 2 ms | 468 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 9 ms | 852 KB | Output is correct |
38 | Correct | 9 ms | 852 KB | Output is correct |
39 | Correct | 30 ms | 1236 KB | Output is correct |
40 | Correct | 17 ms | 1084 KB | Output is correct |
41 | Correct | 37 ms | 1400 KB | Output is correct |
42 | Correct | 16 ms | 1052 KB | Output is correct |
43 | Correct | 27 ms | 1560 KB | Output is correct |
44 | Correct | 28 ms | 1644 KB | Output is correct |
45 | Correct | 28 ms | 1608 KB | Output is correct |
46 | Correct | 16 ms | 724 KB | Output is correct |
47 | Correct | 18 ms | 1108 KB | Output is correct |
48 | Correct | 36 ms | 1620 KB | Output is correct |
49 | Correct | 31 ms | 1272 KB | Output is correct |
50 | Correct | 18 ms | 1084 KB | Output is correct |
51 | Correct | 6 ms | 468 KB | Output is correct |
52 | Correct | 38 ms | 1912 KB | Output is correct |
53 | Correct | 26 ms | 1416 KB | Output is correct |
54 | Correct | 39 ms | 1696 KB | Output is correct |
55 | Correct | 76 ms | 2756 KB | Output is correct |
56 | Correct | 35 ms | 1696 KB | Output is correct |
57 | Correct | 83 ms | 2880 KB | Output is correct |
58 | Correct | 40 ms | 1736 KB | Output is correct |
59 | Correct | 55 ms | 2144 KB | Output is correct |
60 | Correct | 11 ms | 724 KB | Output is correct |
61 | Correct | 64 ms | 2400 KB | Output is correct |
62 | Correct | 59 ms | 2548 KB | Output is correct |
63 | Correct | 64 ms | 2684 KB | Output is correct |
64 | Correct | 62 ms | 2656 KB | Output is correct |
65 | Correct | 31 ms | 1072 KB | Output is correct |
66 | Correct | 33 ms | 1148 KB | Output is correct |
67 | Correct | 65 ms | 2120 KB | Output is correct |
68 | Correct | 31 ms | 1236 KB | Output is correct |
69 | Runtime error | 46 ms | 3752 KB | Execution killed with signal 11 |
70 | Halted | 0 ms | 0 KB | - |