# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
453147 | 2021-08-04T08:18:58 Z | nonsensenonsense1 | Bali Sculptures (APIO15_sculpture) | C++17 | 54 ms | 332 KB |
#include <cstdio> #include <algorithm> const int LG = 60; const int N1 = 100; const int N2 = 2000; int n, a, b, y[N2], mn[N2 + 1]; bool d[N1 + 1][N1 + 1]; inline bool good(long long s, long long x, int l) { return ((x | s) & ~(((long long)1 << l) - 1)) == x; } bool test1(long long x, int l) { for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) { d[i][j] = 0; long long s = 0; for (int k = i - 1; k >= 0; --k) { s += y[k]; if (good(s, x, l)) d[i][j] = d[i][j] || d[k][j - 1]; } if (i == n && j >= a && j <= b && d[i][j]) return true; } return false; } bool test2(long long x, int l) { for (int i = 1; i <= n; ++i) { mn[i] = n + 1; long long s = 0; for (int j = i - 1; j >= 0; --j) { s += y[j]; if (good(s, x, l)) mn[i] = std::min(mn[i], mn[j] + 1); } } return mn[n] <= b; } int main() { scanf("%d%d%d", &n, &a, &b); for (int i = 0; i < n; ++i) scanf("%d", y + i); long long ans = 0; d[0][0] = 1; for (int i = LG - 1; i >= 0; --i) if (a == 1 && !test1(ans, i) || a != 1 && !test2(ans, i)) ans |= (long long)1 << i; printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Incorrect | 0 ms | 204 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Incorrect | 0 ms | 204 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 2 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 3 ms | 204 KB | Output is correct |
17 | Correct | 4 ms | 204 KB | Output is correct |
18 | Correct | 6 ms | 204 KB | Output is correct |
19 | Correct | 7 ms | 204 KB | Output is correct |
20 | Correct | 6 ms | 284 KB | Output is correct |
21 | Correct | 6 ms | 204 KB | Output is correct |
22 | Correct | 6 ms | 204 KB | Output is correct |
23 | Correct | 6 ms | 204 KB | Output is correct |
24 | Correct | 8 ms | 280 KB | Output is correct |
25 | Correct | 13 ms | 332 KB | Output is correct |
26 | Correct | 24 ms | 204 KB | Output is correct |
27 | Correct | 38 ms | 264 KB | Output is correct |
28 | Correct | 47 ms | 204 KB | Output is correct |
29 | Correct | 48 ms | 264 KB | Output is correct |
30 | Correct | 49 ms | 204 KB | Output is correct |
31 | Correct | 47 ms | 204 KB | Output is correct |
32 | Correct | 48 ms | 268 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 276 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Incorrect | 0 ms | 204 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 3 ms | 204 KB | Output is correct |
27 | Correct | 4 ms | 280 KB | Output is correct |
28 | Correct | 8 ms | 284 KB | Output is correct |
29 | Correct | 7 ms | 276 KB | Output is correct |
30 | Correct | 6 ms | 204 KB | Output is correct |
31 | Correct | 6 ms | 204 KB | Output is correct |
32 | Correct | 6 ms | 280 KB | Output is correct |
33 | Correct | 6 ms | 204 KB | Output is correct |
34 | Correct | 7 ms | 284 KB | Output is correct |
35 | Correct | 13 ms | 204 KB | Output is correct |
36 | Correct | 23 ms | 292 KB | Output is correct |
37 | Correct | 35 ms | 204 KB | Output is correct |
38 | Correct | 51 ms | 204 KB | Output is correct |
39 | Correct | 47 ms | 204 KB | Output is correct |
40 | Correct | 49 ms | 204 KB | Output is correct |
41 | Correct | 54 ms | 204 KB | Output is correct |
42 | Correct | 48 ms | 204 KB | Output is correct |
43 | Correct | 6 ms | 204 KB | Output is correct |
44 | Correct | 18 ms | 284 KB | Output is correct |
45 | Correct | 29 ms | 204 KB | Output is correct |
46 | Correct | 40 ms | 264 KB | Output is correct |
47 | Correct | 53 ms | 272 KB | Output is correct |
48 | Correct | 37 ms | 204 KB | Output is correct |
49 | Correct | 39 ms | 268 KB | Output is correct |
50 | Correct | 39 ms | 268 KB | Output is correct |
51 | Correct | 38 ms | 204 KB | Output is correct |
52 | Runtime error | 40 ms | 288 KB | Execution killed with signal 11 |
53 | Halted | 0 ms | 0 KB | - |