# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36173 | 2017-12-06T06:20:46 Z | ToMoClone | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 6524 KB |
/*input 4 1 3 1 5 */ #include <stdio.h> #include <vector> using namespace std; const int N = 501; int check[N * N], cnt[1000001], Lol[501], a[N], n, sum; int main(){ scanf("%d", &n); check[0] = 1; for(int i = 1; i <= n; ++i){ scanf("%d", &a[i]), sum += a[i]; for(int j = sum; j >= a[i]; --j) check[j] += check[j - a[i]]; if(cnt[a[i]] == 1) Lol[i] = 1; else ++cnt[a[i]]; } if((sum & 1) || check[sum >> 1] == 0) return puts("0"), 0; vector<int> ans; for(int i = 1; i <= sum; ++i){ int Sum = sum + i, ok = 1; for(int j = 1; j <= n; ++j){ if(Lol[j]) continue; if(ok == 0 || ((Sum - a[j]) & 1) || (((Sum - a[j]) >> 1) < i)) { ok = 0; break; } int A = 0, sign = 1; for(int k = ((Sum - a[j]) >> 1) - i; k >= 0; k -= a[j]) if(sign) A += check[k], sign ^= 1; else A -= check[k], sign ^= 1; if(A == 0) ok = 0; } if(ok) ans.push_back(i); } printf("%d\n", (int)ans.size()); if(ans.size()) for(int i = 0; i < (int)ans.size(); ++i) printf("%d ", ans[i]); printf("\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
11 | Correct | 0 ms | 6056 KB | Output is correct |
12 | Correct | 0 ms | 6056 KB | Output is correct |
13 | Correct | 0 ms | 6056 KB | Output is correct |
14 | Correct | 0 ms | 6056 KB | Output is correct |
15 | Correct | 0 ms | 6056 KB | Output is correct |
16 | Correct | 0 ms | 6056 KB | Output is correct |
17 | Correct | 0 ms | 6056 KB | Output is correct |
18 | Correct | 0 ms | 6056 KB | Output is correct |
19 | Correct | 0 ms | 6056 KB | Output is correct |
20 | Correct | 0 ms | 6056 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
11 | Correct | 0 ms | 6056 KB | Output is correct |
12 | Correct | 0 ms | 6056 KB | Output is correct |
13 | Correct | 0 ms | 6056 KB | Output is correct |
14 | Correct | 0 ms | 6056 KB | Output is correct |
15 | Correct | 0 ms | 6056 KB | Output is correct |
16 | Correct | 0 ms | 6056 KB | Output is correct |
17 | Correct | 0 ms | 6056 KB | Output is correct |
18 | Correct | 0 ms | 6056 KB | Output is correct |
19 | Correct | 0 ms | 6056 KB | Output is correct |
20 | Correct | 0 ms | 6056 KB | Output is correct |
21 | Correct | 3 ms | 6056 KB | Output is correct |
22 | Correct | 6 ms | 6056 KB | Output is correct |
23 | Correct | 0 ms | 6056 KB | Output is correct |
24 | Correct | 6 ms | 6056 KB | Output is correct |
25 | Correct | 0 ms | 6056 KB | Output is correct |
26 | Correct | 3 ms | 6056 KB | Output is correct |
27 | Correct | 0 ms | 6056 KB | Output is correct |
28 | Correct | 0 ms | 6056 KB | Output is correct |
29 | Correct | 0 ms | 6056 KB | Output is correct |
30 | Correct | 0 ms | 6056 KB | Output is correct |
31 | Correct | 3 ms | 6056 KB | Output is correct |
32 | Correct | 9 ms | 6056 KB | Output is correct |
33 | Correct | 0 ms | 6056 KB | Output is correct |
34 | Correct | 0 ms | 6056 KB | Output is correct |
35 | Correct | 0 ms | 6056 KB | Output is correct |
36 | Correct | 9 ms | 6056 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
11 | Correct | 0 ms | 6056 KB | Output is correct |
12 | Correct | 0 ms | 6056 KB | Output is correct |
13 | Correct | 0 ms | 6056 KB | Output is correct |
14 | Correct | 0 ms | 6056 KB | Output is correct |
15 | Correct | 0 ms | 6056 KB | Output is correct |
16 | Correct | 0 ms | 6056 KB | Output is correct |
17 | Correct | 0 ms | 6056 KB | Output is correct |
18 | Correct | 0 ms | 6056 KB | Output is correct |
19 | Correct | 0 ms | 6056 KB | Output is correct |
20 | Correct | 0 ms | 6056 KB | Output is correct |
21 | Correct | 3 ms | 6056 KB | Output is correct |
22 | Correct | 6 ms | 6056 KB | Output is correct |
23 | Correct | 0 ms | 6056 KB | Output is correct |
24 | Correct | 6 ms | 6056 KB | Output is correct |
25 | Correct | 0 ms | 6056 KB | Output is correct |
26 | Correct | 3 ms | 6056 KB | Output is correct |
27 | Correct | 0 ms | 6056 KB | Output is correct |
28 | Correct | 0 ms | 6056 KB | Output is correct |
29 | Correct | 0 ms | 6056 KB | Output is correct |
30 | Correct | 0 ms | 6056 KB | Output is correct |
31 | Correct | 3 ms | 6056 KB | Output is correct |
32 | Correct | 9 ms | 6056 KB | Output is correct |
33 | Correct | 0 ms | 6056 KB | Output is correct |
34 | Correct | 0 ms | 6056 KB | Output is correct |
35 | Correct | 0 ms | 6056 KB | Output is correct |
36 | Correct | 9 ms | 6056 KB | Output is correct |
37 | Correct | 39 ms | 6196 KB | Output is correct |
38 | Correct | 39 ms | 6196 KB | Output is correct |
39 | Correct | 19 ms | 6056 KB | Output is correct |
40 | Correct | 456 ms | 6196 KB | Output is correct |
41 | Correct | 23 ms | 6056 KB | Output is correct |
42 | Correct | 276 ms | 6196 KB | Output is correct |
43 | Correct | 76 ms | 6328 KB | Output is correct |
44 | Correct | 79 ms | 6328 KB | Output is correct |
45 | Correct | 83 ms | 6328 KB | Output is correct |
46 | Correct | 9 ms | 6056 KB | Output is correct |
47 | Correct | 413 ms | 6196 KB | Output is correct |
48 | Correct | 33 ms | 6328 KB | Output is correct |
49 | Correct | 19 ms | 6196 KB | Output is correct |
50 | Correct | 533 ms | 6196 KB | Output is correct |
51 | Correct | 3 ms | 6056 KB | Output is correct |
52 | Correct | 63 ms | 6328 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
11 | Correct | 0 ms | 6056 KB | Output is correct |
12 | Correct | 0 ms | 6056 KB | Output is correct |
13 | Correct | 0 ms | 6056 KB | Output is correct |
14 | Correct | 0 ms | 6056 KB | Output is correct |
15 | Correct | 0 ms | 6056 KB | Output is correct |
16 | Correct | 0 ms | 6056 KB | Output is correct |
17 | Correct | 0 ms | 6056 KB | Output is correct |
18 | Correct | 0 ms | 6056 KB | Output is correct |
19 | Correct | 0 ms | 6056 KB | Output is correct |
20 | Correct | 0 ms | 6056 KB | Output is correct |
21 | Correct | 3 ms | 6056 KB | Output is correct |
22 | Correct | 6 ms | 6056 KB | Output is correct |
23 | Correct | 0 ms | 6056 KB | Output is correct |
24 | Correct | 6 ms | 6056 KB | Output is correct |
25 | Correct | 0 ms | 6056 KB | Output is correct |
26 | Correct | 3 ms | 6056 KB | Output is correct |
27 | Correct | 0 ms | 6056 KB | Output is correct |
28 | Correct | 0 ms | 6056 KB | Output is correct |
29 | Correct | 0 ms | 6056 KB | Output is correct |
30 | Correct | 0 ms | 6056 KB | Output is correct |
31 | Correct | 3 ms | 6056 KB | Output is correct |
32 | Correct | 9 ms | 6056 KB | Output is correct |
33 | Correct | 0 ms | 6056 KB | Output is correct |
34 | Correct | 0 ms | 6056 KB | Output is correct |
35 | Correct | 0 ms | 6056 KB | Output is correct |
36 | Correct | 9 ms | 6056 KB | Output is correct |
37 | Correct | 39 ms | 6196 KB | Output is correct |
38 | Correct | 39 ms | 6196 KB | Output is correct |
39 | Correct | 19 ms | 6056 KB | Output is correct |
40 | Correct | 456 ms | 6196 KB | Output is correct |
41 | Correct | 23 ms | 6056 KB | Output is correct |
42 | Correct | 276 ms | 6196 KB | Output is correct |
43 | Correct | 76 ms | 6328 KB | Output is correct |
44 | Correct | 79 ms | 6328 KB | Output is correct |
45 | Correct | 83 ms | 6328 KB | Output is correct |
46 | Correct | 9 ms | 6056 KB | Output is correct |
47 | Correct | 413 ms | 6196 KB | Output is correct |
48 | Correct | 33 ms | 6328 KB | Output is correct |
49 | Correct | 19 ms | 6196 KB | Output is correct |
50 | Correct | 533 ms | 6196 KB | Output is correct |
51 | Correct | 3 ms | 6056 KB | Output is correct |
52 | Correct | 63 ms | 6328 KB | Output is correct |
53 | Correct | 319 ms | 6328 KB | Output is correct |
54 | Correct | 459 ms | 6328 KB | Output is correct |
55 | Correct | 133 ms | 6524 KB | Output is correct |
56 | Correct | 459 ms | 6328 KB | Output is correct |
57 | Correct | 156 ms | 6524 KB | Output is correct |
58 | Execution timed out | 1000 ms | 6328 KB | Execution timed out |
59 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6056 KB | Output is correct |
2 | Correct | 0 ms | 6056 KB | Output is correct |
3 | Correct | 0 ms | 6056 KB | Output is correct |
4 | Correct | 0 ms | 6056 KB | Output is correct |
5 | Correct | 0 ms | 6056 KB | Output is correct |
6 | Correct | 0 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
11 | Correct | 0 ms | 6056 KB | Output is correct |
12 | Correct | 0 ms | 6056 KB | Output is correct |
13 | Correct | 0 ms | 6056 KB | Output is correct |
14 | Correct | 0 ms | 6056 KB | Output is correct |
15 | Correct | 0 ms | 6056 KB | Output is correct |
16 | Correct | 0 ms | 6056 KB | Output is correct |
17 | Correct | 0 ms | 6056 KB | Output is correct |
18 | Correct | 0 ms | 6056 KB | Output is correct |
19 | Correct | 0 ms | 6056 KB | Output is correct |
20 | Correct | 0 ms | 6056 KB | Output is correct |
21 | Correct | 3 ms | 6056 KB | Output is correct |
22 | Correct | 6 ms | 6056 KB | Output is correct |
23 | Correct | 0 ms | 6056 KB | Output is correct |
24 | Correct | 6 ms | 6056 KB | Output is correct |
25 | Correct | 0 ms | 6056 KB | Output is correct |
26 | Correct | 3 ms | 6056 KB | Output is correct |
27 | Correct | 0 ms | 6056 KB | Output is correct |
28 | Correct | 0 ms | 6056 KB | Output is correct |
29 | Correct | 0 ms | 6056 KB | Output is correct |
30 | Correct | 0 ms | 6056 KB | Output is correct |
31 | Correct | 3 ms | 6056 KB | Output is correct |
32 | Correct | 9 ms | 6056 KB | Output is correct |
33 | Correct | 0 ms | 6056 KB | Output is correct |
34 | Correct | 0 ms | 6056 KB | Output is correct |
35 | Correct | 0 ms | 6056 KB | Output is correct |
36 | Correct | 9 ms | 6056 KB | Output is correct |
37 | Correct | 39 ms | 6196 KB | Output is correct |
38 | Correct | 39 ms | 6196 KB | Output is correct |
39 | Correct | 19 ms | 6056 KB | Output is correct |
40 | Correct | 456 ms | 6196 KB | Output is correct |
41 | Correct | 23 ms | 6056 KB | Output is correct |
42 | Correct | 276 ms | 6196 KB | Output is correct |
43 | Correct | 76 ms | 6328 KB | Output is correct |
44 | Correct | 79 ms | 6328 KB | Output is correct |
45 | Correct | 83 ms | 6328 KB | Output is correct |
46 | Correct | 9 ms | 6056 KB | Output is correct |
47 | Correct | 413 ms | 6196 KB | Output is correct |
48 | Correct | 33 ms | 6328 KB | Output is correct |
49 | Correct | 19 ms | 6196 KB | Output is correct |
50 | Correct | 533 ms | 6196 KB | Output is correct |
51 | Correct | 3 ms | 6056 KB | Output is correct |
52 | Correct | 63 ms | 6328 KB | Output is correct |
53 | Correct | 319 ms | 6328 KB | Output is correct |
54 | Correct | 459 ms | 6328 KB | Output is correct |
55 | Correct | 133 ms | 6524 KB | Output is correct |
56 | Correct | 459 ms | 6328 KB | Output is correct |
57 | Correct | 156 ms | 6524 KB | Output is correct |
58 | Execution timed out | 1000 ms | 6328 KB | Execution timed out |
59 | Halted | 0 ms | 0 KB | - |