# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
331659 | 2020-11-29T12:11:07 Z | vitkishloh228 | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 524 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); //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 | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 28 ms | 364 KB | Output is correct |
11 | Correct | 71 ms | 364 KB | Output is correct |
12 | Correct | 23 ms | 364 KB | Output is correct |
13 | Correct | 20 ms | 364 KB | Output is correct |
14 | Correct | 90 ms | 364 KB | Output is correct |
15 | Correct | 56 ms | 364 KB | Output is correct |
16 | Correct | 70 ms | 364 KB | Output is correct |
17 | Correct | 25 ms | 492 KB | Output is correct |
18 | Correct | 47 ms | 364 KB | Output is correct |
19 | Correct | 46 ms | 364 KB | Output is correct |
20 | Correct | 35 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 28 ms | 364 KB | Output is correct |
11 | Correct | 71 ms | 364 KB | Output is correct |
12 | Correct | 23 ms | 364 KB | Output is correct |
13 | Correct | 20 ms | 364 KB | Output is correct |
14 | Correct | 90 ms | 364 KB | Output is correct |
15 | Correct | 56 ms | 364 KB | Output is correct |
16 | Correct | 70 ms | 364 KB | Output is correct |
17 | Correct | 25 ms | 492 KB | Output is correct |
18 | Correct | 47 ms | 364 KB | Output is correct |
19 | Correct | 46 ms | 364 KB | Output is correct |
20 | Correct | 35 ms | 364 KB | Output is correct |
21 | Execution timed out | 1057 ms | 524 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 28 ms | 364 KB | Output is correct |
11 | Correct | 71 ms | 364 KB | Output is correct |
12 | Correct | 23 ms | 364 KB | Output is correct |
13 | Correct | 20 ms | 364 KB | Output is correct |
14 | Correct | 90 ms | 364 KB | Output is correct |
15 | Correct | 56 ms | 364 KB | Output is correct |
16 | Correct | 70 ms | 364 KB | Output is correct |
17 | Correct | 25 ms | 492 KB | Output is correct |
18 | Correct | 47 ms | 364 KB | Output is correct |
19 | Correct | 46 ms | 364 KB | Output is correct |
20 | Correct | 35 ms | 364 KB | Output is correct |
21 | Execution timed out | 1057 ms | 524 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 28 ms | 364 KB | Output is correct |
11 | Correct | 71 ms | 364 KB | Output is correct |
12 | Correct | 23 ms | 364 KB | Output is correct |
13 | Correct | 20 ms | 364 KB | Output is correct |
14 | Correct | 90 ms | 364 KB | Output is correct |
15 | Correct | 56 ms | 364 KB | Output is correct |
16 | Correct | 70 ms | 364 KB | Output is correct |
17 | Correct | 25 ms | 492 KB | Output is correct |
18 | Correct | 47 ms | 364 KB | Output is correct |
19 | Correct | 46 ms | 364 KB | Output is correct |
20 | Correct | 35 ms | 364 KB | Output is correct |
21 | Execution timed out | 1057 ms | 524 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Correct | 5 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 20 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 364 KB | Output is correct |
7 | Correct | 5 ms | 364 KB | Output is correct |
8 | Correct | 27 ms | 364 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 28 ms | 364 KB | Output is correct |
11 | Correct | 71 ms | 364 KB | Output is correct |
12 | Correct | 23 ms | 364 KB | Output is correct |
13 | Correct | 20 ms | 364 KB | Output is correct |
14 | Correct | 90 ms | 364 KB | Output is correct |
15 | Correct | 56 ms | 364 KB | Output is correct |
16 | Correct | 70 ms | 364 KB | Output is correct |
17 | Correct | 25 ms | 492 KB | Output is correct |
18 | Correct | 47 ms | 364 KB | Output is correct |
19 | Correct | 46 ms | 364 KB | Output is correct |
20 | Correct | 35 ms | 364 KB | Output is correct |
21 | Execution timed out | 1057 ms | 524 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |