Submission #112120

# Submission time Handle Problem Language Result Execution time Memory
112120 2019-05-17T13:27:03 Z toonewbie Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 16376 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define F first
#define S second

const int N = 2006;
const int INF = 1e9;
const ll INFLL = 1e18;

int n, a, b;
int y[N];
ll p[N];
int dp[N][N];

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> y[i];
        p[i] = p[i - 1] + y[i];
    }
    ll res = 0;
    for (int bt = 42; bt >= 0; bt--) {
        ll cur = (1LL << bt) | res;
        memset(dp, 0, sizeof(dp));
        for (int i = 1; i <= n; i++) {
            if ((p[i] & cur) == 0) {
                dp[1][i] = 1;
            }
        }
        for (int j = 2; j <= n; j++) {
            for (int i = j; i <= n; i++) {
                for (int k = j - 1; k < i; k++) {
                    ll last = p[i] - p[k];
                    if (dp[j - 1][k] == 1 && ((last & cur) == 0)) {
                        dp[j][i] = 1;
                        break;
                    }
                }
            }
        }
        int ok = 1;
        for (int i = a; i <= b; i++) {
            if (dp[i][n]) {
                res |= (1LL << bt);
                break;
            }
        }
    }
    cout << (1LL << 43) - 1 - res << endl;
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:46:13: warning: unused variable 'ok' [-Wunused-variable]
         int ok = 1;
             ^~
# Verdict Execution time Memory Grader output
1 Correct 54 ms 16248 KB Output is correct
2 Correct 56 ms 16128 KB Output is correct
3 Correct 86 ms 16100 KB Output is correct
4 Correct 152 ms 16248 KB Output is correct
5 Correct 66 ms 16128 KB Output is correct
6 Correct 140 ms 16136 KB Output is correct
7 Correct 110 ms 16116 KB Output is correct
8 Correct 130 ms 16248 KB Output is correct
9 Correct 116 ms 16248 KB Output is correct
10 Correct 94 ms 16112 KB Output is correct
11 Correct 55 ms 16168 KB Output is correct
12 Correct 48 ms 16128 KB Output is correct
13 Correct 50 ms 16128 KB Output is correct
14 Correct 65 ms 16128 KB Output is correct
15 Correct 49 ms 16128 KB Output is correct
16 Correct 58 ms 16128 KB Output is correct
17 Correct 60 ms 16164 KB Output is correct
18 Correct 88 ms 16128 KB Output is correct
19 Correct 93 ms 16128 KB Output is correct
20 Correct 63 ms 16128 KB Output is correct
21 Correct 85 ms 16376 KB Output is correct
22 Correct 80 ms 16128 KB Output is correct
23 Correct 53 ms 16128 KB Output is correct
24 Correct 60 ms 16128 KB Output is correct
25 Correct 53 ms 16092 KB Output is correct
26 Correct 56 ms 16128 KB Output is correct
27 Correct 73 ms 16128 KB Output is correct
28 Correct 59 ms 16120 KB Output is correct
29 Correct 48 ms 16128 KB Output is correct
30 Correct 50 ms 16128 KB Output is correct
31 Correct 49 ms 16128 KB Output is correct
32 Correct 55 ms 16128 KB Output is correct
33 Correct 52 ms 16128 KB Output is correct
34 Correct 48 ms 16100 KB Output is correct
35 Correct 46 ms 16128 KB Output is correct
36 Correct 54 ms 16100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 141 ms 16128 KB Output is correct
2 Correct 102 ms 16248 KB Output is correct
3 Correct 69 ms 16120 KB Output is correct
4 Correct 104 ms 16128 KB Output is correct
5 Correct 89 ms 16128 KB Output is correct
6 Correct 122 ms 16128 KB Output is correct
7 Correct 110 ms 16248 KB Output is correct
8 Correct 54 ms 16128 KB Output is correct
9 Correct 52 ms 16128 KB Output is correct
10 Correct 50 ms 16128 KB Output is correct
11 Correct 110 ms 16220 KB Output is correct
12 Correct 79 ms 16128 KB Output is correct
13 Correct 97 ms 16248 KB Output is correct
14 Correct 69 ms 16128 KB Output is correct
15 Correct 55 ms 16128 KB Output is correct
16 Correct 56 ms 16128 KB Output is correct
17 Correct 50 ms 16128 KB Output is correct
18 Correct 52 ms 16128 KB Output is correct
19 Correct 75 ms 16128 KB Output is correct
20 Correct 62 ms 16128 KB Output is correct
21 Correct 49 ms 16128 KB Output is correct
22 Correct 53 ms 16128 KB Output is correct
23 Correct 60 ms 16128 KB Output is correct
24 Correct 82 ms 16128 KB Output is correct
25 Correct 73 ms 16128 KB Output is correct
26 Correct 138 ms 16128 KB Output is correct
27 Correct 152 ms 16248 KB Output is correct
28 Correct 91 ms 16128 KB Output is correct
29 Correct 92 ms 16128 KB Output is correct
30 Correct 86 ms 16128 KB Output is correct
31 Correct 117 ms 16128 KB Output is correct
32 Correct 126 ms 16248 KB Output is correct
33 Correct 104 ms 16136 KB Output is correct
34 Correct 82 ms 16136 KB Output is correct
35 Correct 142 ms 16128 KB Output is correct
36 Correct 51 ms 16128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 16136 KB Output is correct
2 Correct 99 ms 16132 KB Output is correct
3 Correct 109 ms 16128 KB Output is correct
4 Correct 104 ms 16128 KB Output is correct
5 Correct 85 ms 16128 KB Output is correct
6 Correct 52 ms 16140 KB Output is correct
7 Correct 126 ms 16128 KB Output is correct
8 Correct 132 ms 16132 KB Output is correct
9 Correct 119 ms 16100 KB Output is correct
10 Correct 93 ms 16128 KB Output is correct
11 Correct 95 ms 16128 KB Output is correct
12 Correct 68 ms 16128 KB Output is correct
13 Correct 102 ms 16252 KB Output is correct
14 Correct 155 ms 16128 KB Output is correct
15 Correct 52 ms 16168 KB Output is correct
16 Correct 50 ms 16128 KB Output is correct
17 Correct 59 ms 16248 KB Output is correct
18 Correct 51 ms 16128 KB Output is correct
19 Correct 77 ms 16252 KB Output is correct
20 Correct 50 ms 16128 KB Output is correct
21 Correct 56 ms 16128 KB Output is correct
22 Correct 53 ms 16128 KB Output is correct
23 Correct 91 ms 16112 KB Output is correct
24 Correct 56 ms 16128 KB Output is correct
25 Correct 51 ms 16128 KB Output is correct
26 Correct 78 ms 16128 KB Output is correct
27 Correct 108 ms 16128 KB Output is correct
28 Correct 80 ms 16128 KB Output is correct
29 Correct 101 ms 16248 KB Output is correct
30 Correct 58 ms 16128 KB Output is correct
31 Correct 82 ms 16128 KB Output is correct
32 Correct 85 ms 16248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 16128 KB Output is correct
2 Correct 61 ms 16128 KB Output is correct
3 Correct 74 ms 16248 KB Output is correct
4 Correct 79 ms 16128 KB Output is correct
5 Correct 65 ms 16128 KB Output is correct
6 Correct 56 ms 16128 KB Output is correct
7 Correct 49 ms 16128 KB Output is correct
8 Correct 67 ms 16092 KB Output is correct
9 Correct 69 ms 16128 KB Output is correct
10 Correct 61 ms 16128 KB Output is correct
11 Correct 51 ms 16128 KB Output is correct
12 Correct 53 ms 16128 KB Output is correct
13 Correct 51 ms 16248 KB Output is correct
14 Correct 84 ms 16128 KB Output is correct
15 Correct 51 ms 16248 KB Output is correct
16 Correct 64 ms 16172 KB Output is correct
17 Correct 76 ms 16128 KB Output is correct
18 Correct 51 ms 16128 KB Output is correct
19 Correct 91 ms 16128 KB Output is correct
20 Correct 48 ms 16128 KB Output is correct
21 Correct 55 ms 16132 KB Output is correct
22 Correct 53 ms 16128 KB Output is correct
23 Correct 53 ms 16128 KB Output is correct
24 Correct 51 ms 16164 KB Output is correct
25 Correct 49 ms 16108 KB Output is correct
26 Correct 104 ms 16128 KB Output is correct
27 Correct 79 ms 16128 KB Output is correct
28 Correct 117 ms 16128 KB Output is correct
29 Correct 122 ms 16128 KB Output is correct
30 Correct 71 ms 16204 KB Output is correct
31 Correct 63 ms 16128 KB Output is correct
32 Correct 54 ms 16128 KB Output is correct
33 Correct 132 ms 16128 KB Output is correct
34 Correct 50 ms 16128 KB Output is correct
35 Correct 77 ms 16128 KB Output is correct
36 Correct 99 ms 16220 KB Output is correct
37 Correct 80 ms 16132 KB Output is correct
38 Correct 51 ms 16128 KB Output is correct
39 Correct 52 ms 16116 KB Output is correct
40 Correct 51 ms 16128 KB Output is correct
41 Correct 52 ms 16256 KB Output is correct
42 Correct 156 ms 16220 KB Output is correct
43 Correct 160 ms 16128 KB Output is correct
44 Correct 71 ms 16168 KB Output is correct
45 Correct 78 ms 16132 KB Output is correct
46 Correct 75 ms 16128 KB Output is correct
47 Correct 102 ms 16172 KB Output is correct
48 Correct 135 ms 16128 KB Output is correct
49 Correct 126 ms 16164 KB Output is correct
50 Correct 68 ms 16136 KB Output is correct
51 Correct 50 ms 16128 KB Output is correct
52 Correct 50 ms 16128 KB Output is correct
53 Correct 66 ms 16128 KB Output is correct
54 Correct 53 ms 16156 KB Output is correct
55 Correct 83 ms 16128 KB Output is correct
56 Correct 51 ms 16128 KB Output is correct
57 Correct 59 ms 16248 KB Output is correct
58 Correct 115 ms 16128 KB Output is correct
59 Correct 110 ms 16168 KB Output is correct
60 Correct 57 ms 16236 KB Output is correct
61 Correct 55 ms 16128 KB Output is correct
62 Correct 71 ms 16128 KB Output is correct
63 Correct 126 ms 16128 KB Output is correct
64 Correct 64 ms 16128 KB Output is correct
65 Correct 78 ms 16132 KB Output is correct
66 Correct 51 ms 16128 KB Output is correct
67 Correct 54 ms 16128 KB Output is correct
68 Correct 54 ms 16128 KB Output is correct
69 Correct 118 ms 16128 KB Output is correct
70 Correct 152 ms 16128 KB Output is correct
71 Correct 59 ms 16128 KB Output is correct
72 Correct 57 ms 16128 KB Output is correct
73 Correct 84 ms 16128 KB Output is correct
74 Correct 72 ms 16132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 16128 KB Output is correct
2 Correct 89 ms 16128 KB Output is correct
3 Correct 74 ms 16168 KB Output is correct
4 Correct 62 ms 16044 KB Output is correct
5 Correct 113 ms 16168 KB Output is correct
6 Correct 107 ms 16088 KB Output is correct
7 Correct 125 ms 16128 KB Output is correct
8 Correct 101 ms 16248 KB Output is correct
9 Correct 49 ms 16128 KB Output is correct
10 Correct 84 ms 16172 KB Output is correct
11 Correct 124 ms 16248 KB Output is correct
12 Correct 104 ms 16128 KB Output is correct
13 Correct 114 ms 16248 KB Output is correct
14 Correct 103 ms 16220 KB Output is correct
15 Correct 50 ms 16128 KB Output is correct
16 Correct 129 ms 16128 KB Output is correct
17 Correct 116 ms 16248 KB Output is correct
18 Correct 65 ms 16136 KB Output is correct
19 Correct 116 ms 16132 KB Output is correct
20 Correct 91 ms 16128 KB Output is correct
21 Correct 101 ms 16128 KB Output is correct
22 Correct 67 ms 16220 KB Output is correct
23 Correct 83 ms 16164 KB Output is correct
24 Correct 57 ms 16128 KB Output is correct
25 Correct 50 ms 16128 KB Output is correct
26 Correct 84 ms 16128 KB Output is correct
27 Correct 48 ms 16128 KB Output is correct
28 Correct 92 ms 16164 KB Output is correct
29 Correct 106 ms 16168 KB Output is correct
30 Correct 56 ms 16128 KB Output is correct
31 Correct 56 ms 16128 KB Output is correct
32 Correct 54 ms 16128 KB Output is correct
33 Correct 68 ms 16128 KB Output is correct
34 Correct 56 ms 16128 KB Output is correct
35 Correct 48 ms 16128 KB Output is correct
36 Correct 59 ms 16248 KB Output is correct
37 Correct 55 ms 16128 KB Output is correct
38 Correct 51 ms 16128 KB Output is correct
39 Correct 52 ms 16128 KB Output is correct
40 Correct 54 ms 16128 KB Output is correct
41 Correct 71 ms 16140 KB Output is correct
42 Correct 87 ms 16176 KB Output is correct
43 Correct 53 ms 16128 KB Output is correct
44 Correct 52 ms 16128 KB Output is correct
45 Correct 52 ms 16128 KB Output is correct
46 Correct 56 ms 16128 KB Output is correct
47 Correct 58 ms 16128 KB Output is correct
48 Correct 105 ms 16248 KB Output is correct
49 Correct 100 ms 16120 KB Output is correct
50 Correct 97 ms 16128 KB Output is correct
51 Correct 102 ms 16132 KB Output is correct
52 Execution timed out 1051 ms 16224 KB Time limit exceeded
53 Halted 0 ms 0 KB -