답안 #735279

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735279 2023-05-03T19:58:47 Z colossal_pepe Bali Sculptures (APIO15_sculpture) C++17
71 / 100
57 ms 1484 KB
#include <iostream>
#include <cstring>
using namespace std;

using ll = long long;

const int N = 100;

int n, a, b;
ll x[N + 5];
bool vis[N + 5][N + 5][N + 5], using_cuts[N + 5];

bool isSubmask(ll sup, ll sub) {
    return (sup | sub) == sup;
}

void brutus(int l, int r, int cuts, ll c) {
    if (r == n) using_cuts[cuts] |= isSubmask(c, x[r] - x[l - 1]);
    else if (vis[l][r][cuts]) return;
    else {
        vis[l][r][cuts] = 1;
        brutus(l, r + 1, cuts, c);
        if (isSubmask(c, x[r] - x[l - 1])) brutus(r + 1, r + 1, cuts + 1, c);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (n > N) exit(0);
    cin >> n >> a >> b;
    x[0] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
        x[i] += x[i - 1];
    }
    ll c = (1ll << 40) - 1;
    for (ll bit = 39; bit >= 0; bit--) {
        c -= (1ll << bit);
        memset(vis, 0, sizeof vis);
        memset(using_cuts, 0, sizeof using_cuts);
        brutus(1, 1, 1, c);
        bool ok = 0;
        for (int i = a; i <= b; i++) {
            ok |= using_cuts[i];
        }
        if (not ok) c += (1ll << bit);
    }
    cout << c << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 3 ms 1364 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 3 ms 1364 KB Output is correct
8 Correct 3 ms 1364 KB Output is correct
9 Correct 2 ms 1352 KB Output is correct
10 Correct 3 ms 1364 KB Output is correct
11 Correct 4 ms 1364 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 2 ms 1364 KB Output is correct
15 Correct 3 ms 1364 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 3 ms 1348 KB Output is correct
18 Correct 3 ms 1364 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 5 ms 1364 KB Output is correct
21 Correct 2 ms 1364 KB Output is correct
22 Correct 3 ms 1352 KB Output is correct
23 Correct 3 ms 1364 KB Output is correct
24 Correct 2 ms 1364 KB Output is correct
25 Correct 2 ms 1364 KB Output is correct
26 Correct 3 ms 1352 KB Output is correct
27 Correct 2 ms 1364 KB Output is correct
28 Correct 2 ms 1364 KB Output is correct
29 Correct 2 ms 1352 KB Output is correct
30 Correct 2 ms 1364 KB Output is correct
31 Correct 3 ms 1364 KB Output is correct
32 Correct 2 ms 1364 KB Output is correct
33 Correct 2 ms 1364 KB Output is correct
34 Correct 2 ms 1364 KB Output is correct
35 Correct 2 ms 1364 KB Output is correct
36 Correct 3 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 3 ms 1364 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 3 ms 1364 KB Output is correct
8 Correct 4 ms 1364 KB Output is correct
9 Correct 3 ms 1364 KB Output is correct
10 Correct 3 ms 1364 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 2 ms 1352 KB Output is correct
15 Correct 2 ms 1364 KB Output is correct
16 Correct 2 ms 1456 KB Output is correct
17 Correct 3 ms 1364 KB Output is correct
18 Correct 2 ms 1364 KB Output is correct
19 Correct 2 ms 1348 KB Output is correct
20 Correct 2 ms 1364 KB Output is correct
21 Correct 2 ms 1352 KB Output is correct
22 Correct 2 ms 1348 KB Output is correct
23 Correct 3 ms 1364 KB Output is correct
24 Correct 3 ms 1364 KB Output is correct
25 Correct 3 ms 1364 KB Output is correct
26 Correct 4 ms 1364 KB Output is correct
27 Correct 3 ms 1352 KB Output is correct
28 Correct 3 ms 1364 KB Output is correct
29 Correct 4 ms 1364 KB Output is correct
30 Correct 5 ms 1364 KB Output is correct
31 Correct 8 ms 1364 KB Output is correct
32 Correct 8 ms 1364 KB Output is correct
33 Correct 7 ms 1364 KB Output is correct
34 Correct 7 ms 1364 KB Output is correct
35 Correct 8 ms 1364 KB Output is correct
36 Correct 7 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1348 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1364 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 3 ms 1348 KB Output is correct
12 Correct 3 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 3 ms 1364 KB Output is correct
15 Correct 5 ms 1364 KB Output is correct
16 Correct 4 ms 1352 KB Output is correct
17 Correct 5 ms 1364 KB Output is correct
18 Correct 7 ms 1364 KB Output is correct
19 Correct 7 ms 1364 KB Output is correct
20 Correct 7 ms 1456 KB Output is correct
21 Correct 7 ms 1364 KB Output is correct
22 Correct 10 ms 1364 KB Output is correct
23 Correct 8 ms 1452 KB Output is correct
24 Correct 10 ms 1452 KB Output is correct
25 Correct 13 ms 1448 KB Output is correct
26 Correct 20 ms 1456 KB Output is correct
27 Correct 32 ms 1352 KB Output is correct
28 Correct 42 ms 1440 KB Output is correct
29 Correct 38 ms 1440 KB Output is correct
30 Correct 43 ms 1364 KB Output is correct
31 Correct 42 ms 1364 KB Output is correct
32 Correct 39 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 3 ms 1364 KB Output is correct
9 Correct 3 ms 1356 KB Output is correct
10 Correct 2 ms 1352 KB Output is correct
11 Correct 3 ms 1348 KB Output is correct
12 Correct 3 ms 1348 KB Output is correct
13 Correct 3 ms 1364 KB Output is correct
14 Correct 2 ms 1352 KB Output is correct
15 Correct 2 ms 1352 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 2 ms 1456 KB Output is correct
18 Correct 2 ms 1364 KB Output is correct
19 Correct 3 ms 1364 KB Output is correct
20 Correct 2 ms 1364 KB Output is correct
21 Correct 4 ms 1364 KB Output is correct
22 Correct 3 ms 1364 KB Output is correct
23 Correct 2 ms 1352 KB Output is correct
24 Correct 3 ms 1352 KB Output is correct
25 Correct 3 ms 1364 KB Output is correct
26 Correct 3 ms 1364 KB Output is correct
27 Correct 2 ms 1352 KB Output is correct
28 Correct 2 ms 1364 KB Output is correct
29 Correct 2 ms 1344 KB Output is correct
30 Correct 2 ms 1364 KB Output is correct
31 Correct 2 ms 1364 KB Output is correct
32 Correct 2 ms 1364 KB Output is correct
33 Correct 2 ms 1364 KB Output is correct
34 Correct 3 ms 1364 KB Output is correct
35 Correct 2 ms 1364 KB Output is correct
36 Correct 2 ms 1364 KB Output is correct
37 Correct 3 ms 1352 KB Output is correct
38 Correct 3 ms 1364 KB Output is correct
39 Correct 5 ms 1348 KB Output is correct
40 Correct 5 ms 1364 KB Output is correct
41 Correct 7 ms 1352 KB Output is correct
42 Correct 6 ms 1364 KB Output is correct
43 Correct 7 ms 1456 KB Output is correct
44 Correct 8 ms 1364 KB Output is correct
45 Correct 9 ms 1460 KB Output is correct
46 Correct 7 ms 1364 KB Output is correct
47 Correct 8 ms 1364 KB Output is correct
48 Correct 13 ms 1364 KB Output is correct
49 Correct 20 ms 1356 KB Output is correct
50 Correct 36 ms 1484 KB Output is correct
51 Correct 49 ms 1440 KB Output is correct
52 Correct 39 ms 1364 KB Output is correct
53 Correct 41 ms 1452 KB Output is correct
54 Correct 48 ms 1348 KB Output is correct
55 Correct 40 ms 1456 KB Output is correct
56 Correct 3 ms 1352 KB Output is correct
57 Correct 9 ms 1456 KB Output is correct
58 Correct 10 ms 1452 KB Output is correct
59 Correct 12 ms 1352 KB Output is correct
60 Correct 12 ms 1456 KB Output is correct
61 Correct 18 ms 1364 KB Output is correct
62 Correct 15 ms 1452 KB Output is correct
63 Correct 16 ms 1364 KB Output is correct
64 Correct 32 ms 1364 KB Output is correct
65 Correct 4 ms 1364 KB Output is correct
66 Correct 6 ms 1456 KB Output is correct
67 Correct 8 ms 1364 KB Output is correct
68 Correct 11 ms 1356 KB Output is correct
69 Correct 13 ms 1460 KB Output is correct
70 Correct 12 ms 1364 KB Output is correct
71 Correct 12 ms 1452 KB Output is correct
72 Correct 16 ms 1352 KB Output is correct
73 Correct 17 ms 1364 KB Output is correct
74 Correct 17 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1348 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 2 ms 1352 KB Output is correct
5 Correct 2 ms 1364 KB Output is correct
6 Correct 2 ms 1348 KB Output is correct
7 Correct 3 ms 1364 KB Output is correct
8 Correct 2 ms 1364 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 3 ms 1352 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 3 ms 1364 KB Output is correct
13 Correct 4 ms 1364 KB Output is correct
14 Correct 2 ms 1364 KB Output is correct
15 Correct 3 ms 1364 KB Output is correct
16 Correct 2 ms 1348 KB Output is correct
17 Correct 2 ms 1364 KB Output is correct
18 Correct 2 ms 1348 KB Output is correct
19 Correct 2 ms 1364 KB Output is correct
20 Correct 2 ms 1348 KB Output is correct
21 Correct 3 ms 1364 KB Output is correct
22 Correct 2 ms 1348 KB Output is correct
23 Correct 3 ms 1356 KB Output is correct
24 Correct 3 ms 1364 KB Output is correct
25 Correct 3 ms 1364 KB Output is correct
26 Correct 4 ms 1364 KB Output is correct
27 Correct 5 ms 1460 KB Output is correct
28 Correct 7 ms 1352 KB Output is correct
29 Correct 7 ms 1364 KB Output is correct
30 Correct 7 ms 1364 KB Output is correct
31 Correct 8 ms 1364 KB Output is correct
32 Correct 9 ms 1364 KB Output is correct
33 Correct 8 ms 1364 KB Output is correct
34 Correct 7 ms 1352 KB Output is correct
35 Correct 13 ms 1364 KB Output is correct
36 Correct 26 ms 1344 KB Output is correct
37 Correct 34 ms 1364 KB Output is correct
38 Correct 41 ms 1364 KB Output is correct
39 Correct 42 ms 1364 KB Output is correct
40 Correct 50 ms 1436 KB Output is correct
41 Correct 57 ms 1440 KB Output is correct
42 Correct 53 ms 1364 KB Output is correct
43 Correct 4 ms 1364 KB Output is correct
44 Correct 8 ms 1364 KB Output is correct
45 Correct 9 ms 1364 KB Output is correct
46 Correct 12 ms 1356 KB Output is correct
47 Correct 12 ms 1460 KB Output is correct
48 Correct 18 ms 1364 KB Output is correct
49 Correct 19 ms 1364 KB Output is correct
50 Correct 16 ms 1456 KB Output is correct
51 Correct 15 ms 1460 KB Output is correct
52 Runtime error 2 ms 468 KB Execution killed with signal 11
53 Halted 0 ms 0 KB -