# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
331660 | 2020-11-29T12:12:03 Z | vitkishloh228 | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 492 KB |
#include<iostream> #include<vector> #include<algorithm> #include<bitset> using namespace std; const int maxc = 10000; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int S = 0; for (auto elem : a) { S += elem; } bitset<maxc> dp1; dp1[0] = 1; for (int i = 0; i < n; i++) { dp1 |= dp1 << a[i]; } vector<int> ans; for (int L = 0; L < 3000; ++L) { int needsum = (S + L); bool ok = dp1[S / 2]; if (!ok) { cout << 0; return 0; } for (int j = 0; j < n; ++j) { if (((S + L - a[j]) & 1) == 1) { ok = false; break; } bitset<maxc> dp; dp[0] = 1; for (int i = 0; i < n; i++) { if (i == j) continue; dp |= dp << a[i]; } dp |= dp << L; if (!dp[(S + L - a[j]) / 2]) { ok = false; break; } } if (ok) { ans.push_back(L); } } cout << ans.size() << '\n'; for (auto elem : ans) cout << elem << ' '; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
10 | Correct | 30 ms | 364 KB | Output is correct |
11 | Correct | 64 ms | 364 KB | Output is correct |
12 | Correct | 20 ms | 364 KB | Output is correct |
13 | Correct | 17 ms | 364 KB | Output is correct |
14 | Correct | 64 ms | 364 KB | Output is correct |
15 | Correct | 53 ms | 492 KB | Output is correct |
16 | Correct | 65 ms | 364 KB | Output is correct |
17 | Correct | 21 ms | 364 KB | Output is correct |
18 | Correct | 40 ms | 364 KB | Output is correct |
19 | Correct | 42 ms | 364 KB | Output is correct |
20 | Correct | 24 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
10 | Correct | 30 ms | 364 KB | Output is correct |
11 | Correct | 64 ms | 364 KB | Output is correct |
12 | Correct | 20 ms | 364 KB | Output is correct |
13 | Correct | 17 ms | 364 KB | Output is correct |
14 | Correct | 64 ms | 364 KB | Output is correct |
15 | Correct | 53 ms | 492 KB | Output is correct |
16 | Correct | 65 ms | 364 KB | Output is correct |
17 | Correct | 21 ms | 364 KB | Output is correct |
18 | Correct | 40 ms | 364 KB | Output is correct |
19 | Correct | 42 ms | 364 KB | Output is correct |
20 | Correct | 24 ms | 364 KB | Output is correct |
21 | Execution timed out | 1095 ms | 368 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
10 | Correct | 30 ms | 364 KB | Output is correct |
11 | Correct | 64 ms | 364 KB | Output is correct |
12 | Correct | 20 ms | 364 KB | Output is correct |
13 | Correct | 17 ms | 364 KB | Output is correct |
14 | Correct | 64 ms | 364 KB | Output is correct |
15 | Correct | 53 ms | 492 KB | Output is correct |
16 | Correct | 65 ms | 364 KB | Output is correct |
17 | Correct | 21 ms | 364 KB | Output is correct |
18 | Correct | 40 ms | 364 KB | Output is correct |
19 | Correct | 42 ms | 364 KB | Output is correct |
20 | Correct | 24 ms | 364 KB | Output is correct |
21 | Execution timed out | 1095 ms | 368 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
10 | Correct | 30 ms | 364 KB | Output is correct |
11 | Correct | 64 ms | 364 KB | Output is correct |
12 | Correct | 20 ms | 364 KB | Output is correct |
13 | Correct | 17 ms | 364 KB | Output is correct |
14 | Correct | 64 ms | 364 KB | Output is correct |
15 | Correct | 53 ms | 492 KB | Output is correct |
16 | Correct | 65 ms | 364 KB | Output is correct |
17 | Correct | 21 ms | 364 KB | Output is correct |
18 | Correct | 40 ms | 364 KB | Output is correct |
19 | Correct | 42 ms | 364 KB | Output is correct |
20 | Correct | 24 ms | 364 KB | Output is correct |
21 | Execution timed out | 1095 ms | 368 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 19 ms | 364 KB | Output is correct |
9 | Correct | 9 ms | 364 KB | Output is correct |
10 | Correct | 30 ms | 364 KB | Output is correct |
11 | Correct | 64 ms | 364 KB | Output is correct |
12 | Correct | 20 ms | 364 KB | Output is correct |
13 | Correct | 17 ms | 364 KB | Output is correct |
14 | Correct | 64 ms | 364 KB | Output is correct |
15 | Correct | 53 ms | 492 KB | Output is correct |
16 | Correct | 65 ms | 364 KB | Output is correct |
17 | Correct | 21 ms | 364 KB | Output is correct |
18 | Correct | 40 ms | 364 KB | Output is correct |
19 | Correct | 42 ms | 364 KB | Output is correct |
20 | Correct | 24 ms | 364 KB | Output is correct |
21 | Execution timed out | 1095 ms | 368 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |