# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609594 | 2022-07-27T17:46:59 Z | Plurm | Bali Sculptures (APIO15_sculpture) | C++11 | 479 ms | 4352 KB |
#include <bits/stdc++.h> using namespace std; int y[2048]; int dp[2048]; bool check[2048][2048]; bool dps[128][128]; long long qs[2048]; int main() { int n, a, b; scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; i++) { scanf("%d", y + i); qs[i] = qs[i - 1] + y[i]; } long long oldmask = 0ll; for (long long bit = 60; bit >= 0; bit--) { long long mask = oldmask | ((1ll << bit) - 1ll); for (int i = 1; i <= n; i++) { long long sum = 0ll; for (int j = i; j <= n; j++) { sum += y[j]; check[i][j] = (sum | mask) == mask; } } if (a == 1) { for (int i = 1; i <= n; i++) { if (check[1][i]) dp[i] = 1; else dp[i] = 1e9; for (int j = 1; j < i; j++) { if (check[j + 1][i]) { dp[i] = min(dp[j] + 1, dp[i]); } } } if (dp[n] > b) { oldmask |= 1ll << bit; } } else { memset(dps, 0, sizeof(dps)); for (int k = 1; k <= n; k++) { for (int i = 1; i <= n; i++) { for (int j = 0; j < i; j++) { if (check[j + 1][i] && (dps[k - 1][j] || j == 0)) { dps[k][i] = true; } } } } bool ok = false; for (int k = a; k <= b; k++) ok |= dps[k][n]; if (!ok) { oldmask |= 1ll << bit; } } } printf("%lld\n", oldmask); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 316 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 308 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Incorrect | 1 ms | 340 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 312 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 312 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 312 KB | Output is correct |
13 | Correct | 1 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Incorrect | 1 ms | 340 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 308 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 356 KB | Output is correct |
6 | Correct | 0 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 304 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 2 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 468 KB | Output is correct |
27 | Correct | 1 ms | 468 KB | Output is correct |
28 | Correct | 2 ms | 468 KB | Output is correct |
29 | Correct | 2 ms | 468 KB | Output is correct |
30 | Correct | 2 ms | 468 KB | Output is correct |
31 | Correct | 2 ms | 468 KB | Output is correct |
32 | Correct | 2 ms | 436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 308 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 0 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 316 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Incorrect | 1 ms | 340 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 0 ms | 308 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 312 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 312 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 308 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 312 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 428 KB | Output is correct |
31 | Correct | 1 ms | 344 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 1 ms | 344 KB | Output is correct |
36 | Correct | 1 ms | 436 KB | Output is correct |
37 | Correct | 2 ms | 472 KB | Output is correct |
38 | Correct | 2 ms | 468 KB | Output is correct |
39 | Correct | 2 ms | 468 KB | Output is correct |
40 | Correct | 2 ms | 468 KB | Output is correct |
41 | Correct | 2 ms | 468 KB | Output is correct |
42 | Correct | 2 ms | 468 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 1 ms | 468 KB | Output is correct |
45 | Correct | 1 ms | 436 KB | Output is correct |
46 | Correct | 1 ms | 436 KB | Output is correct |
47 | Correct | 2 ms | 468 KB | Output is correct |
48 | Correct | 2 ms | 524 KB | Output is correct |
49 | Correct | 2 ms | 436 KB | Output is correct |
50 | Correct | 2 ms | 436 KB | Output is correct |
51 | Correct | 2 ms | 468 KB | Output is correct |
52 | Correct | 36 ms | 1460 KB | Output is correct |
53 | Correct | 59 ms | 1828 KB | Output is correct |
54 | Correct | 109 ms | 2332 KB | Output is correct |
55 | Correct | 108 ms | 2324 KB | Output is correct |
56 | Correct | 429 ms | 4348 KB | Output is correct |
57 | Correct | 434 ms | 4344 KB | Output is correct |
58 | Correct | 438 ms | 4348 KB | Output is correct |
59 | Correct | 446 ms | 4344 KB | Output is correct |
60 | Correct | 421 ms | 4344 KB | Output is correct |
61 | Correct | 2 ms | 468 KB | Output is correct |
62 | Correct | 63 ms | 1816 KB | Output is correct |
63 | Correct | 116 ms | 2328 KB | Output is correct |
64 | Correct | 102 ms | 2260 KB | Output is correct |
65 | Correct | 211 ms | 3156 KB | Output is correct |
66 | Correct | 334 ms | 3776 KB | Output is correct |
67 | Correct | 435 ms | 4344 KB | Output is correct |
68 | Correct | 438 ms | 4344 KB | Output is correct |
69 | Correct | 479 ms | 4352 KB | Output is correct |