# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
331657 | 2020-11-29T12:09:24 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 < maxc; ++L) { int needsum = (S + L); //if ((S + L) % 2 == 1) continue; bool ok = dp1[S / 2]; //cout << ok << endl; for (int j = 0; j < n; ++j) { if ((S + L - a[j]) % 2 == 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 | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 61 ms | 364 KB | Output is correct |
11 | Correct | 97 ms | 364 KB | Output is correct |
12 | Correct | 60 ms | 492 KB | Output is correct |
13 | Correct | 54 ms | 364 KB | Output is correct |
14 | Correct | 91 ms | 364 KB | Output is correct |
15 | Correct | 82 ms | 364 KB | Output is correct |
16 | Correct | 102 ms | 384 KB | Output is correct |
17 | Correct | 54 ms | 364 KB | Output is correct |
18 | Correct | 70 ms | 364 KB | Output is correct |
19 | Correct | 73 ms | 384 KB | Output is correct |
20 | Correct | 61 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 61 ms | 364 KB | Output is correct |
11 | Correct | 97 ms | 364 KB | Output is correct |
12 | Correct | 60 ms | 492 KB | Output is correct |
13 | Correct | 54 ms | 364 KB | Output is correct |
14 | Correct | 91 ms | 364 KB | Output is correct |
15 | Correct | 82 ms | 364 KB | Output is correct |
16 | Correct | 102 ms | 384 KB | Output is correct |
17 | Correct | 54 ms | 364 KB | Output is correct |
18 | Correct | 70 ms | 364 KB | Output is correct |
19 | Correct | 73 ms | 384 KB | Output is correct |
20 | Correct | 61 ms | 364 KB | Output is correct |
21 | Execution timed out | 1044 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 61 ms | 364 KB | Output is correct |
11 | Correct | 97 ms | 364 KB | Output is correct |
12 | Correct | 60 ms | 492 KB | Output is correct |
13 | Correct | 54 ms | 364 KB | Output is correct |
14 | Correct | 91 ms | 364 KB | Output is correct |
15 | Correct | 82 ms | 364 KB | Output is correct |
16 | Correct | 102 ms | 384 KB | Output is correct |
17 | Correct | 54 ms | 364 KB | Output is correct |
18 | Correct | 70 ms | 364 KB | Output is correct |
19 | Correct | 73 ms | 384 KB | Output is correct |
20 | Correct | 61 ms | 364 KB | Output is correct |
21 | Execution timed out | 1044 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 61 ms | 364 KB | Output is correct |
11 | Correct | 97 ms | 364 KB | Output is correct |
12 | Correct | 60 ms | 492 KB | Output is correct |
13 | Correct | 54 ms | 364 KB | Output is correct |
14 | Correct | 91 ms | 364 KB | Output is correct |
15 | Correct | 82 ms | 364 KB | Output is correct |
16 | Correct | 102 ms | 384 KB | Output is correct |
17 | Correct | 54 ms | 364 KB | Output is correct |
18 | Correct | 70 ms | 364 KB | Output is correct |
19 | Correct | 73 ms | 384 KB | Output is correct |
20 | Correct | 61 ms | 364 KB | Output is correct |
21 | Execution timed out | 1044 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 12 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 8 ms | 364 KB | Output is correct |
5 | Correct | 32 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 492 KB | Output is correct |
7 | Correct | 12 ms | 364 KB | Output is correct |
8 | Correct | 38 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 61 ms | 364 KB | Output is correct |
11 | Correct | 97 ms | 364 KB | Output is correct |
12 | Correct | 60 ms | 492 KB | Output is correct |
13 | Correct | 54 ms | 364 KB | Output is correct |
14 | Correct | 91 ms | 364 KB | Output is correct |
15 | Correct | 82 ms | 364 KB | Output is correct |
16 | Correct | 102 ms | 384 KB | Output is correct |
17 | Correct | 54 ms | 364 KB | Output is correct |
18 | Correct | 70 ms | 364 KB | Output is correct |
19 | Correct | 73 ms | 384 KB | Output is correct |
20 | Correct | 61 ms | 364 KB | Output is correct |
21 | Execution timed out | 1044 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |