# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45828 | 2018-04-16T08:34:26 Z | antimirage | Bali Sculptures (APIO15_sculpture) | C++17 | 85 ms | 1072 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define mk make_pair #define pb push_back #define OK puts("OK"); #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() using namespace std; const int N = 105; int n, a, b, ar[N], cnt; bool dp[N][N]; long long ans, sum, pref[N]; main() { cin >> n >> a >> b; for (int i = 1; i <= n; i++) scanf("%d", &ar[i]), pref[i] = pref[i - 1] + ar[i]; for (int k = 40; k >= 0; k--) { long long cur = (1LL << k); memset(dp, 0, sizeof(dp) ); dp[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int l = 1; l <= j; l++) { if ( ( ans | ( ( (pref[j] - pref[l - 1]) >> k) << k) ) == ans ) dp[i][j] |= dp[i - 1][l - 1]; } } } bool fl = 0; for (int i = a; i <= b; i++) fl |= dp[i][n]; if (!fl) ans += cur; } cout << ans << endl; } /** 6 1 3 8 1 2 1 5 4 **/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 556 KB | Output is correct |
5 | Correct | 2 ms | 556 KB | Output is correct |
6 | Correct | 2 ms | 556 KB | Output is correct |
7 | Correct | 2 ms | 556 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 2 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Correct | 2 ms | 748 KB | Output is correct |
16 | Correct | 2 ms | 748 KB | Output is correct |
17 | Correct | 2 ms | 748 KB | Output is correct |
18 | Correct | 2 ms | 748 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 3 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 2 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 2 ms | 748 KB | Output is correct |
30 | Correct | 2 ms | 748 KB | Output is correct |
31 | Correct | 3 ms | 748 KB | Output is correct |
32 | Correct | 2 ms | 748 KB | Output is correct |
33 | Correct | 2 ms | 748 KB | Output is correct |
34 | Correct | 2 ms | 748 KB | Output is correct |
35 | Correct | 2 ms | 748 KB | Output is correct |
36 | Correct | 2 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Correct | 2 ms | 748 KB | Output is correct |
3 | Correct | 2 ms | 748 KB | Output is correct |
4 | Correct | 2 ms | 748 KB | Output is correct |
5 | Correct | 2 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
7 | Correct | 2 ms | 748 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 2 ms | 748 KB | Output is correct |
11 | Correct | 2 ms | 748 KB | Output is correct |
12 | Correct | 2 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Correct | 2 ms | 748 KB | Output is correct |
16 | Correct | 2 ms | 748 KB | Output is correct |
17 | Correct | 2 ms | 748 KB | Output is correct |
18 | Correct | 2 ms | 748 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 3 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 3 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 2 ms | 748 KB | Output is correct |
28 | Correct | 3 ms | 748 KB | Output is correct |
29 | Correct | 4 ms | 748 KB | Output is correct |
30 | Correct | 6 ms | 748 KB | Output is correct |
31 | Correct | 8 ms | 748 KB | Output is correct |
32 | Correct | 11 ms | 748 KB | Output is correct |
33 | Correct | 9 ms | 748 KB | Output is correct |
34 | Correct | 9 ms | 748 KB | Output is correct |
35 | Correct | 9 ms | 748 KB | Output is correct |
36 | Correct | 9 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Correct | 2 ms | 748 KB | Output is correct |
3 | Correct | 2 ms | 748 KB | Output is correct |
4 | Correct | 2 ms | 748 KB | Output is correct |
5 | Correct | 2 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
7 | Correct | 2 ms | 748 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 3 ms | 784 KB | Output is correct |
10 | Correct | 2 ms | 784 KB | Output is correct |
11 | Correct | 2 ms | 784 KB | Output is correct |
12 | Correct | 2 ms | 784 KB | Output is correct |
13 | Correct | 2 ms | 784 KB | Output is correct |
14 | Correct | 3 ms | 784 KB | Output is correct |
15 | Correct | 2 ms | 784 KB | Output is correct |
16 | Correct | 5 ms | 784 KB | Output is correct |
17 | Correct | 6 ms | 784 KB | Output is correct |
18 | Correct | 8 ms | 784 KB | Output is correct |
19 | Correct | 8 ms | 784 KB | Output is correct |
20 | Correct | 9 ms | 784 KB | Output is correct |
21 | Correct | 8 ms | 784 KB | Output is correct |
22 | Correct | 8 ms | 784 KB | Output is correct |
23 | Correct | 8 ms | 784 KB | Output is correct |
24 | Correct | 10 ms | 784 KB | Output is correct |
25 | Correct | 16 ms | 784 KB | Output is correct |
26 | Correct | 27 ms | 784 KB | Output is correct |
27 | Correct | 45 ms | 784 KB | Output is correct |
28 | Correct | 54 ms | 784 KB | Output is correct |
29 | Correct | 54 ms | 784 KB | Output is correct |
30 | Correct | 85 ms | 784 KB | Output is correct |
31 | Correct | 54 ms | 784 KB | Output is correct |
32 | Correct | 56 ms | 784 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 784 KB | Output is correct |
2 | Correct | 2 ms | 784 KB | Output is correct |
3 | Correct | 2 ms | 784 KB | Output is correct |
4 | Correct | 2 ms | 784 KB | Output is correct |
5 | Correct | 2 ms | 784 KB | Output is correct |
6 | Correct | 2 ms | 784 KB | Output is correct |
7 | Correct | 2 ms | 784 KB | Output is correct |
8 | Correct | 2 ms | 784 KB | Output is correct |
9 | Correct | 3 ms | 784 KB | Output is correct |
10 | Correct | 2 ms | 784 KB | Output is correct |
11 | Correct | 3 ms | 784 KB | Output is correct |
12 | Correct | 3 ms | 784 KB | Output is correct |
13 | Correct | 2 ms | 784 KB | Output is correct |
14 | Correct | 2 ms | 784 KB | Output is correct |
15 | Correct | 2 ms | 784 KB | Output is correct |
16 | Correct | 2 ms | 784 KB | Output is correct |
17 | Correct | 2 ms | 784 KB | Output is correct |
18 | Correct | 2 ms | 784 KB | Output is correct |
19 | Correct | 3 ms | 784 KB | Output is correct |
20 | Correct | 2 ms | 784 KB | Output is correct |
21 | Correct | 2 ms | 784 KB | Output is correct |
22 | Correct | 2 ms | 784 KB | Output is correct |
23 | Correct | 2 ms | 784 KB | Output is correct |
24 | Correct | 2 ms | 784 KB | Output is correct |
25 | Correct | 2 ms | 784 KB | Output is correct |
26 | Correct | 2 ms | 784 KB | Output is correct |
27 | Correct | 2 ms | 784 KB | Output is correct |
28 | Correct | 2 ms | 784 KB | Output is correct |
29 | Correct | 2 ms | 784 KB | Output is correct |
30 | Correct | 2 ms | 784 KB | Output is correct |
31 | Correct | 2 ms | 784 KB | Output is correct |
32 | Correct | 2 ms | 784 KB | Output is correct |
33 | Correct | 2 ms | 784 KB | Output is correct |
34 | Correct | 2 ms | 784 KB | Output is correct |
35 | Correct | 2 ms | 784 KB | Output is correct |
36 | Correct | 2 ms | 784 KB | Output is correct |
37 | Correct | 2 ms | 784 KB | Output is correct |
38 | Correct | 3 ms | 784 KB | Output is correct |
39 | Correct | 5 ms | 784 KB | Output is correct |
40 | Correct | 6 ms | 784 KB | Output is correct |
41 | Correct | 8 ms | 784 KB | Output is correct |
42 | Correct | 9 ms | 784 KB | Output is correct |
43 | Correct | 8 ms | 784 KB | Output is correct |
44 | Correct | 9 ms | 852 KB | Output is correct |
45 | Correct | 8 ms | 852 KB | Output is correct |
46 | Correct | 8 ms | 852 KB | Output is correct |
47 | Correct | 12 ms | 852 KB | Output is correct |
48 | Correct | 16 ms | 852 KB | Output is correct |
49 | Correct | 27 ms | 852 KB | Output is correct |
50 | Correct | 42 ms | 852 KB | Output is correct |
51 | Correct | 53 ms | 852 KB | Output is correct |
52 | Correct | 53 ms | 852 KB | Output is correct |
53 | Correct | 54 ms | 852 KB | Output is correct |
54 | Correct | 53 ms | 852 KB | Output is correct |
55 | Correct | 54 ms | 852 KB | Output is correct |
56 | Correct | 8 ms | 852 KB | Output is correct |
57 | Correct | 25 ms | 852 KB | Output is correct |
58 | Correct | 37 ms | 876 KB | Output is correct |
59 | Correct | 48 ms | 912 KB | Output is correct |
60 | Correct | 56 ms | 912 KB | Output is correct |
61 | Correct | 46 ms | 912 KB | Output is correct |
62 | Correct | 47 ms | 912 KB | Output is correct |
63 | Correct | 47 ms | 912 KB | Output is correct |
64 | Correct | 41 ms | 912 KB | Output is correct |
65 | Correct | 8 ms | 912 KB | Output is correct |
66 | Correct | 15 ms | 912 KB | Output is correct |
67 | Correct | 24 ms | 912 KB | Output is correct |
68 | Correct | 36 ms | 912 KB | Output is correct |
69 | Correct | 51 ms | 912 KB | Output is correct |
70 | Correct | 46 ms | 912 KB | Output is correct |
71 | Correct | 54 ms | 912 KB | Output is correct |
72 | Correct | 56 ms | 912 KB | Output is correct |
73 | Correct | 53 ms | 992 KB | Output is correct |
74 | Correct | 48 ms | 992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 992 KB | Output is correct |
2 | Correct | 2 ms | 992 KB | Output is correct |
3 | Correct | 2 ms | 992 KB | Output is correct |
4 | Correct | 2 ms | 992 KB | Output is correct |
5 | Correct | 2 ms | 992 KB | Output is correct |
6 | Correct | 2 ms | 992 KB | Output is correct |
7 | Correct | 2 ms | 992 KB | Output is correct |
8 | Correct | 3 ms | 992 KB | Output is correct |
9 | Correct | 3 ms | 992 KB | Output is correct |
10 | Correct | 2 ms | 992 KB | Output is correct |
11 | Correct | 2 ms | 992 KB | Output is correct |
12 | Correct | 2 ms | 992 KB | Output is correct |
13 | Correct | 2 ms | 992 KB | Output is correct |
14 | Correct | 2 ms | 992 KB | Output is correct |
15 | Correct | 2 ms | 992 KB | Output is correct |
16 | Correct | 2 ms | 992 KB | Output is correct |
17 | Correct | 2 ms | 992 KB | Output is correct |
18 | Correct | 2 ms | 992 KB | Output is correct |
19 | Correct | 2 ms | 992 KB | Output is correct |
20 | Correct | 2 ms | 992 KB | Output is correct |
21 | Correct | 2 ms | 992 KB | Output is correct |
22 | Correct | 2 ms | 992 KB | Output is correct |
23 | Correct | 2 ms | 1008 KB | Output is correct |
24 | Correct | 2 ms | 1008 KB | Output is correct |
25 | Correct | 3 ms | 1008 KB | Output is correct |
26 | Correct | 6 ms | 1008 KB | Output is correct |
27 | Correct | 6 ms | 1008 KB | Output is correct |
28 | Correct | 8 ms | 1008 KB | Output is correct |
29 | Correct | 8 ms | 1008 KB | Output is correct |
30 | Correct | 8 ms | 1008 KB | Output is correct |
31 | Correct | 9 ms | 1008 KB | Output is correct |
32 | Correct | 8 ms | 1008 KB | Output is correct |
33 | Correct | 8 ms | 1008 KB | Output is correct |
34 | Correct | 9 ms | 1008 KB | Output is correct |
35 | Correct | 17 ms | 1008 KB | Output is correct |
36 | Correct | 26 ms | 1008 KB | Output is correct |
37 | Correct | 42 ms | 1008 KB | Output is correct |
38 | Correct | 55 ms | 1008 KB | Output is correct |
39 | Correct | 54 ms | 1008 KB | Output is correct |
40 | Correct | 59 ms | 1008 KB | Output is correct |
41 | Correct | 70 ms | 1008 KB | Output is correct |
42 | Correct | 72 ms | 1008 KB | Output is correct |
43 | Correct | 8 ms | 1008 KB | Output is correct |
44 | Correct | 25 ms | 1008 KB | Output is correct |
45 | Correct | 37 ms | 1008 KB | Output is correct |
46 | Correct | 46 ms | 1008 KB | Output is correct |
47 | Correct | 47 ms | 1008 KB | Output is correct |
48 | Correct | 47 ms | 1008 KB | Output is correct |
49 | Correct | 50 ms | 1008 KB | Output is correct |
50 | Correct | 49 ms | 1032 KB | Output is correct |
51 | Correct | 49 ms | 1032 KB | Output is correct |
52 | Runtime error | 16 ms | 1072 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
53 | Halted | 0 ms | 0 KB | - |