# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
173505 | 2020-01-04T10:16:54 Z | AllMight | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 632 KB |
#include <iostream> #include <algorithm> #include <vector> using namespace std; const int N = 502; int n; int a[N]; int cnt[N * N]; vector <int> v; void check(int ind) { int mx = 0; vector <bool> knp(N * N, false); knp[0] = true; for (int i = 0; i < n; i++) { if (i == ind) continue; for (int j = mx; j >= 0; j--) { if (knp[j]) { knp[j + a[i]] = true; mx = max(mx, j + a[i]); } } } int sum = mx; for (int i = 0; 2 * i < sum; i++) { if (!knp[i]) continue; int ans = sum - 2 * i; cnt[ans]++; if (ind == 0) v.push_back(ans); } } int main() { ios_base::sync_with_stdio(false); cin >> n; int mx = 0; vector <bool> knp(N * N, false); knp[0] = true; for (int i = 0; i < n; i++) { cin >> a[i]; for (int j = mx; j >= 0; j--) { if (knp[j]) { knp[j + a[i]] = true; mx = max(mx, j + a[i]); } } } int sum = mx; if (sum % 2 || !knp[sum / 2]) { cout << "0\n"; return 0; } for (int i = 0; i < n; i++) check(i); vector <int> ans; for (int i = 0; i < v.size(); i++) if (cnt[v[i]] == n) ans.push_back(v[i]); sort(ans.begin(), ans.end()); cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' '; cout << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 31 ms | 476 KB | Output is correct |
22 | Correct | 47 ms | 380 KB | Output is correct |
23 | Correct | 15 ms | 376 KB | Output is correct |
24 | Correct | 88 ms | 504 KB | Output is correct |
25 | Correct | 118 ms | 504 KB | Output is correct |
26 | Correct | 148 ms | 552 KB | Output is correct |
27 | Correct | 101 ms | 496 KB | Output is correct |
28 | Correct | 106 ms | 536 KB | Output is correct |
29 | Correct | 108 ms | 504 KB | Output is correct |
30 | Correct | 116 ms | 504 KB | Output is correct |
31 | Correct | 161 ms | 604 KB | Output is correct |
32 | Correct | 109 ms | 504 KB | Output is correct |
33 | Correct | 80 ms | 376 KB | Output is correct |
34 | Correct | 79 ms | 376 KB | Output is correct |
35 | Correct | 101 ms | 504 KB | Output is correct |
36 | Correct | 104 ms | 500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 31 ms | 476 KB | Output is correct |
22 | Correct | 47 ms | 380 KB | Output is correct |
23 | Correct | 15 ms | 376 KB | Output is correct |
24 | Correct | 88 ms | 504 KB | Output is correct |
25 | Correct | 118 ms | 504 KB | Output is correct |
26 | Correct | 148 ms | 552 KB | Output is correct |
27 | Correct | 101 ms | 496 KB | Output is correct |
28 | Correct | 106 ms | 536 KB | Output is correct |
29 | Correct | 108 ms | 504 KB | Output is correct |
30 | Correct | 116 ms | 504 KB | Output is correct |
31 | Correct | 161 ms | 604 KB | Output is correct |
32 | Correct | 109 ms | 504 KB | Output is correct |
33 | Correct | 80 ms | 376 KB | Output is correct |
34 | Correct | 79 ms | 376 KB | Output is correct |
35 | Correct | 101 ms | 504 KB | Output is correct |
36 | Correct | 104 ms | 500 KB | Output is correct |
37 | Execution timed out | 1080 ms | 632 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 31 ms | 476 KB | Output is correct |
22 | Correct | 47 ms | 380 KB | Output is correct |
23 | Correct | 15 ms | 376 KB | Output is correct |
24 | Correct | 88 ms | 504 KB | Output is correct |
25 | Correct | 118 ms | 504 KB | Output is correct |
26 | Correct | 148 ms | 552 KB | Output is correct |
27 | Correct | 101 ms | 496 KB | Output is correct |
28 | Correct | 106 ms | 536 KB | Output is correct |
29 | Correct | 108 ms | 504 KB | Output is correct |
30 | Correct | 116 ms | 504 KB | Output is correct |
31 | Correct | 161 ms | 604 KB | Output is correct |
32 | Correct | 109 ms | 504 KB | Output is correct |
33 | Correct | 80 ms | 376 KB | Output is correct |
34 | Correct | 79 ms | 376 KB | Output is correct |
35 | Correct | 101 ms | 504 KB | Output is correct |
36 | Correct | 104 ms | 500 KB | Output is correct |
37 | Execution timed out | 1080 ms | 632 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 31 ms | 476 KB | Output is correct |
22 | Correct | 47 ms | 380 KB | Output is correct |
23 | Correct | 15 ms | 376 KB | Output is correct |
24 | Correct | 88 ms | 504 KB | Output is correct |
25 | Correct | 118 ms | 504 KB | Output is correct |
26 | Correct | 148 ms | 552 KB | Output is correct |
27 | Correct | 101 ms | 496 KB | Output is correct |
28 | Correct | 106 ms | 536 KB | Output is correct |
29 | Correct | 108 ms | 504 KB | Output is correct |
30 | Correct | 116 ms | 504 KB | Output is correct |
31 | Correct | 161 ms | 604 KB | Output is correct |
32 | Correct | 109 ms | 504 KB | Output is correct |
33 | Correct | 80 ms | 376 KB | Output is correct |
34 | Correct | 79 ms | 376 KB | Output is correct |
35 | Correct | 101 ms | 504 KB | Output is correct |
36 | Correct | 104 ms | 500 KB | Output is correct |
37 | Execution timed out | 1080 ms | 632 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |