Submission #918303

# Submission time Handle Problem Language Result Execution time Memory
918303 2024-01-29T14:54:45 Z sq00 Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<int>v(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
    }
    long long ans = 1e18;
    for(int i = 0; i < (1 << n); i++) {
        long long g = 0, sum = 0;
        for(int j = 0; j < n; j++) {
            sum += v[j + 1];
            if(i & (1 << j)) {
                g |= sum;
                sum = 0;
            }
        }
        g |= sum;
        //cout << i << ": " << g << '\n';
        int bits = __builtin_popcount(i) + ((i & (1 << (n - 1))) == 0);
        if(a <= bits && bits <= b) ans = min(ans, g);
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Correct 66 ms 428 KB Output is correct
9 Correct 67 ms 500 KB Output is correct
10 Correct 65 ms 424 KB Output is correct
11 Correct 65 ms 348 KB Output is correct
12 Correct 68 ms 348 KB Output is correct
13 Correct 71 ms 432 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 452 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 10 ms 348 KB Output is correct
21 Correct 64 ms 432 KB Output is correct
22 Correct 66 ms 432 KB Output is correct
23 Correct 77 ms 348 KB Output is correct
24 Correct 66 ms 496 KB Output is correct
25 Correct 65 ms 500 KB Output is correct
26 Correct 64 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 32 ms 348 KB Output is correct
31 Correct 67 ms 344 KB Output is correct
32 Correct 65 ms 348 KB Output is correct
33 Correct 64 ms 436 KB Output is correct
34 Correct 69 ms 344 KB Output is correct
35 Correct 68 ms 432 KB Output is correct
36 Correct 74 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 67 ms 344 KB Output is correct
9 Correct 66 ms 428 KB Output is correct
10 Correct 65 ms 348 KB Output is correct
11 Correct 66 ms 348 KB Output is correct
12 Correct 74 ms 436 KB Output is correct
13 Correct 67 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 456 KB Output is correct
20 Correct 10 ms 348 KB Output is correct
21 Correct 63 ms 348 KB Output is correct
22 Correct 66 ms 428 KB Output is correct
23 Correct 70 ms 344 KB Output is correct
24 Correct 66 ms 348 KB Output is correct
25 Correct 65 ms 344 KB Output is correct
26 Correct 63 ms 348 KB Output is correct
27 Correct 137 ms 344 KB Output is correct
28 Execution timed out 1048 ms 344 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Correct 66 ms 436 KB Output is correct
9 Correct 65 ms 344 KB Output is correct
10 Correct 65 ms 428 KB Output is correct
11 Correct 66 ms 436 KB Output is correct
12 Correct 65 ms 428 KB Output is correct
13 Correct 70 ms 348 KB Output is correct
14 Correct 133 ms 428 KB Output is correct
15 Execution timed out 1035 ms 348 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 9 ms 348 KB Output is correct
8 Correct 67 ms 348 KB Output is correct
9 Correct 67 ms 440 KB Output is correct
10 Correct 66 ms 424 KB Output is correct
11 Correct 70 ms 348 KB Output is correct
12 Correct 66 ms 348 KB Output is correct
13 Correct 66 ms 428 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 460 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 8 ms 456 KB Output is correct
21 Correct 62 ms 348 KB Output is correct
22 Correct 63 ms 428 KB Output is correct
23 Correct 66 ms 428 KB Output is correct
24 Correct 66 ms 436 KB Output is correct
25 Correct 63 ms 344 KB Output is correct
26 Correct 63 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 32 ms 348 KB Output is correct
31 Correct 63 ms 348 KB Output is correct
32 Correct 66 ms 348 KB Output is correct
33 Correct 66 ms 348 KB Output is correct
34 Correct 65 ms 348 KB Output is correct
35 Correct 66 ms 348 KB Output is correct
36 Correct 68 ms 428 KB Output is correct
37 Correct 132 ms 348 KB Output is correct
38 Execution timed out 1030 ms 344 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Correct 67 ms 600 KB Output is correct
9 Correct 67 ms 348 KB Output is correct
10 Correct 65 ms 348 KB Output is correct
11 Correct 67 ms 432 KB Output is correct
12 Correct 65 ms 344 KB Output is correct
13 Correct 64 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 33 ms 348 KB Output is correct
18 Correct 63 ms 424 KB Output is correct
19 Correct 65 ms 344 KB Output is correct
20 Correct 63 ms 432 KB Output is correct
21 Correct 64 ms 428 KB Output is correct
22 Correct 65 ms 424 KB Output is correct
23 Correct 71 ms 344 KB Output is correct
24 Correct 132 ms 432 KB Output is correct
25 Execution timed out 1026 ms 344 KB Time limit exceeded
26 Halted 0 ms 0 KB -