# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
343378 | 2021-01-03T19:49:10 Z | Kalashnikov | Bootfall (IZhO17_bootfall) | C++17 | 1000 ms | 10236 KB |
#include <bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) #define all(a) a.begin() , a.end() #define F first #define S second using namespace std; using ll = long long; const int N = 500+5 , inf = 2e9 + 7; const ll INF = 1e18 , mod = 1e9+7 , P = 6547; int a[N]; bitset<250010> dp[N]; void solve() { int n; cin >> n; int sum = 0; for(int i = 1; i <= n; i ++) { cin >> a[i]; sum += a[i]; } for(int i = 0; i <= n; i ++) { for(int j = 1; j <= n; j ++) { if(i == j) continue; dp[i] = (dp[i] | (dp[i] << a[j])); dp[i][a[j]] = 1; } } if(sum%2 || !dp[0][sum/2]) { cout << 0; return; } vector<int> ans; for(int i = 0; i <= sum; i ++) { int ok = 1; for(int j = 1; j <= n; j ++) { int cur = sum-a[j]+i; if(cur%2 || !dp[j][cur/2]) { ok = 0; break; } } if(ok) ans.push_back(i); } cout << ans.size() << '\n'; for(auto to: ans) { cout << to << ' '; } } /* 5 5 5 5 15 */ main() { file("subsequence"); ios; int tt = 1; //cin >> tt; while(tt --) { solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 11 ms | 1388 KB | Output is correct |
11 | Correct | 11 ms | 1388 KB | Output is correct |
12 | Correct | 15 ms | 1388 KB | Output is correct |
13 | Correct | 9 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 10 ms | 1260 KB | Output is correct |
16 | Correct | 11 ms | 1388 KB | Output is correct |
17 | Correct | 4 ms | 1004 KB | Output is correct |
18 | Correct | 7 ms | 1132 KB | Output is correct |
19 | Correct | 8 ms | 1280 KB | Output is correct |
20 | Correct | 11 ms | 1388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 11 ms | 1388 KB | Output is correct |
11 | Correct | 11 ms | 1388 KB | Output is correct |
12 | Correct | 15 ms | 1388 KB | Output is correct |
13 | Correct | 9 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 10 ms | 1260 KB | Output is correct |
16 | Correct | 11 ms | 1388 KB | Output is correct |
17 | Correct | 4 ms | 1004 KB | Output is correct |
18 | Correct | 7 ms | 1132 KB | Output is correct |
19 | Correct | 8 ms | 1280 KB | Output is correct |
20 | Correct | 11 ms | 1388 KB | Output is correct |
21 | Correct | 51 ms | 2472 KB | Output is correct |
22 | Correct | 62 ms | 2796 KB | Output is correct |
23 | Correct | 30 ms | 2028 KB | Output is correct |
24 | Correct | 99 ms | 3308 KB | Output is correct |
25 | Correct | 98 ms | 3436 KB | Output is correct |
26 | Correct | 111 ms | 3584 KB | Output is correct |
27 | Correct | 112 ms | 3584 KB | Output is correct |
28 | Correct | 111 ms | 3564 KB | Output is correct |
29 | Correct | 110 ms | 3436 KB | Output is correct |
30 | Correct | 109 ms | 3436 KB | Output is correct |
31 | Correct | 113 ms | 3564 KB | Output is correct |
32 | Correct | 110 ms | 3564 KB | Output is correct |
33 | Correct | 109 ms | 3436 KB | Output is correct |
34 | Correct | 112 ms | 3436 KB | Output is correct |
35 | Correct | 110 ms | 3564 KB | Output is correct |
36 | Correct | 111 ms | 3564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 11 ms | 1388 KB | Output is correct |
11 | Correct | 11 ms | 1388 KB | Output is correct |
12 | Correct | 15 ms | 1388 KB | Output is correct |
13 | Correct | 9 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 10 ms | 1260 KB | Output is correct |
16 | Correct | 11 ms | 1388 KB | Output is correct |
17 | Correct | 4 ms | 1004 KB | Output is correct |
18 | Correct | 7 ms | 1132 KB | Output is correct |
19 | Correct | 8 ms | 1280 KB | Output is correct |
20 | Correct | 11 ms | 1388 KB | Output is correct |
21 | Correct | 51 ms | 2472 KB | Output is correct |
22 | Correct | 62 ms | 2796 KB | Output is correct |
23 | Correct | 30 ms | 2028 KB | Output is correct |
24 | Correct | 99 ms | 3308 KB | Output is correct |
25 | Correct | 98 ms | 3436 KB | Output is correct |
26 | Correct | 111 ms | 3584 KB | Output is correct |
27 | Correct | 112 ms | 3584 KB | Output is correct |
28 | Correct | 111 ms | 3564 KB | Output is correct |
29 | Correct | 110 ms | 3436 KB | Output is correct |
30 | Correct | 109 ms | 3436 KB | Output is correct |
31 | Correct | 113 ms | 3564 KB | Output is correct |
32 | Correct | 110 ms | 3564 KB | Output is correct |
33 | Correct | 109 ms | 3436 KB | Output is correct |
34 | Correct | 112 ms | 3436 KB | Output is correct |
35 | Correct | 110 ms | 3564 KB | Output is correct |
36 | Correct | 111 ms | 3564 KB | Output is correct |
37 | Correct | 441 ms | 6764 KB | Output is correct |
38 | Correct | 448 ms | 6764 KB | Output is correct |
39 | Correct | 672 ms | 8044 KB | Output is correct |
40 | Correct | 809 ms | 9004 KB | Output is correct |
41 | Correct | 798 ms | 8812 KB | Output is correct |
42 | Correct | 690 ms | 8300 KB | Output is correct |
43 | Correct | 664 ms | 8300 KB | Output is correct |
44 | Correct | 694 ms | 8556 KB | Output is correct |
45 | Correct | 700 ms | 8684 KB | Output is correct |
46 | Correct | 787 ms | 8812 KB | Output is correct |
47 | Correct | 690 ms | 8300 KB | Output is correct |
48 | Correct | 698 ms | 8556 KB | Output is correct |
49 | Correct | 680 ms | 8172 KB | Output is correct |
50 | Correct | 711 ms | 8384 KB | Output is correct |
51 | Correct | 681 ms | 8300 KB | Output is correct |
52 | Correct | 818 ms | 9196 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 11 ms | 1388 KB | Output is correct |
11 | Correct | 11 ms | 1388 KB | Output is correct |
12 | Correct | 15 ms | 1388 KB | Output is correct |
13 | Correct | 9 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 10 ms | 1260 KB | Output is correct |
16 | Correct | 11 ms | 1388 KB | Output is correct |
17 | Correct | 4 ms | 1004 KB | Output is correct |
18 | Correct | 7 ms | 1132 KB | Output is correct |
19 | Correct | 8 ms | 1280 KB | Output is correct |
20 | Correct | 11 ms | 1388 KB | Output is correct |
21 | Correct | 51 ms | 2472 KB | Output is correct |
22 | Correct | 62 ms | 2796 KB | Output is correct |
23 | Correct | 30 ms | 2028 KB | Output is correct |
24 | Correct | 99 ms | 3308 KB | Output is correct |
25 | Correct | 98 ms | 3436 KB | Output is correct |
26 | Correct | 111 ms | 3584 KB | Output is correct |
27 | Correct | 112 ms | 3584 KB | Output is correct |
28 | Correct | 111 ms | 3564 KB | Output is correct |
29 | Correct | 110 ms | 3436 KB | Output is correct |
30 | Correct | 109 ms | 3436 KB | Output is correct |
31 | Correct | 113 ms | 3564 KB | Output is correct |
32 | Correct | 110 ms | 3564 KB | Output is correct |
33 | Correct | 109 ms | 3436 KB | Output is correct |
34 | Correct | 112 ms | 3436 KB | Output is correct |
35 | Correct | 110 ms | 3564 KB | Output is correct |
36 | Correct | 111 ms | 3564 KB | Output is correct |
37 | Correct | 441 ms | 6764 KB | Output is correct |
38 | Correct | 448 ms | 6764 KB | Output is correct |
39 | Correct | 672 ms | 8044 KB | Output is correct |
40 | Correct | 809 ms | 9004 KB | Output is correct |
41 | Correct | 798 ms | 8812 KB | Output is correct |
42 | Correct | 690 ms | 8300 KB | Output is correct |
43 | Correct | 664 ms | 8300 KB | Output is correct |
44 | Correct | 694 ms | 8556 KB | Output is correct |
45 | Correct | 700 ms | 8684 KB | Output is correct |
46 | Correct | 787 ms | 8812 KB | Output is correct |
47 | Correct | 690 ms | 8300 KB | Output is correct |
48 | Correct | 698 ms | 8556 KB | Output is correct |
49 | Correct | 680 ms | 8172 KB | Output is correct |
50 | Correct | 711 ms | 8384 KB | Output is correct |
51 | Correct | 681 ms | 8300 KB | Output is correct |
52 | Correct | 818 ms | 9196 KB | Output is correct |
53 | Execution timed out | 1000 ms | 10236 KB | Time limit exceeded |
54 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 4 ms | 748 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 11 ms | 1388 KB | Output is correct |
11 | Correct | 11 ms | 1388 KB | Output is correct |
12 | Correct | 15 ms | 1388 KB | Output is correct |
13 | Correct | 9 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 10 ms | 1260 KB | Output is correct |
16 | Correct | 11 ms | 1388 KB | Output is correct |
17 | Correct | 4 ms | 1004 KB | Output is correct |
18 | Correct | 7 ms | 1132 KB | Output is correct |
19 | Correct | 8 ms | 1280 KB | Output is correct |
20 | Correct | 11 ms | 1388 KB | Output is correct |
21 | Correct | 51 ms | 2472 KB | Output is correct |
22 | Correct | 62 ms | 2796 KB | Output is correct |
23 | Correct | 30 ms | 2028 KB | Output is correct |
24 | Correct | 99 ms | 3308 KB | Output is correct |
25 | Correct | 98 ms | 3436 KB | Output is correct |
26 | Correct | 111 ms | 3584 KB | Output is correct |
27 | Correct | 112 ms | 3584 KB | Output is correct |
28 | Correct | 111 ms | 3564 KB | Output is correct |
29 | Correct | 110 ms | 3436 KB | Output is correct |
30 | Correct | 109 ms | 3436 KB | Output is correct |
31 | Correct | 113 ms | 3564 KB | Output is correct |
32 | Correct | 110 ms | 3564 KB | Output is correct |
33 | Correct | 109 ms | 3436 KB | Output is correct |
34 | Correct | 112 ms | 3436 KB | Output is correct |
35 | Correct | 110 ms | 3564 KB | Output is correct |
36 | Correct | 111 ms | 3564 KB | Output is correct |
37 | Correct | 441 ms | 6764 KB | Output is correct |
38 | Correct | 448 ms | 6764 KB | Output is correct |
39 | Correct | 672 ms | 8044 KB | Output is correct |
40 | Correct | 809 ms | 9004 KB | Output is correct |
41 | Correct | 798 ms | 8812 KB | Output is correct |
42 | Correct | 690 ms | 8300 KB | Output is correct |
43 | Correct | 664 ms | 8300 KB | Output is correct |
44 | Correct | 694 ms | 8556 KB | Output is correct |
45 | Correct | 700 ms | 8684 KB | Output is correct |
46 | Correct | 787 ms | 8812 KB | Output is correct |
47 | Correct | 690 ms | 8300 KB | Output is correct |
48 | Correct | 698 ms | 8556 KB | Output is correct |
49 | Correct | 680 ms | 8172 KB | Output is correct |
50 | Correct | 711 ms | 8384 KB | Output is correct |
51 | Correct | 681 ms | 8300 KB | Output is correct |
52 | Correct | 818 ms | 9196 KB | Output is correct |
53 | Execution timed out | 1000 ms | 10236 KB | Time limit exceeded |
54 | Halted | 0 ms | 0 KB | - |