Submission #131118

# Submission time Handle Problem Language Result Execution time Memory
131118 2019-07-16T14:17:15 Z mlyean00 Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 504 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> y(n);
    for (int i = 0; i < n; ++i) {
        cin >> y[i];
    }

    vector<ll> pref(n + 1, 0);
    partial_sum(y.begin(), y.end(), pref.begin() + 1);

    ll ans = LLONG_MAX;
    for (ll i = 0; i < 1LL << (n - 1); ++i) {
        int set_bits = __builtin_popcount(i) + 1;
        if (set_bits < a || set_bits > b) continue;
        int last = 0;
        ll res = 0;
        for (int j = i; j; j -= j & -j) {
            int k = __builtin_ctz(j) + 1;
            res |= pref[k] - pref[last];
            last = k;
        }
        res |= pref[n] - pref[last];
        ans = min(ans, res);
    }

    cout << ans << endl;

    return 0;
}
# 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 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 11 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 5 ms 256 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 12 ms 256 KB Output is correct
34 Correct 14 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 12 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 4 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 14 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 380 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 4 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 12 ms 504 KB Output is correct
27 Correct 24 ms 504 KB Output is correct
28 Correct 113 ms 476 KB Output is correct
29 Execution timed out 1080 ms 376 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 308 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 24 ms 376 KB Output is correct
15 Correct 112 ms 352 KB Output is correct
16 Execution timed out 1052 ms 256 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 4 ms 252 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 13 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 352 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 4 ms 252 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 11 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 3 ms 380 KB Output is correct
31 Correct 5 ms 376 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 12 ms 376 KB Output is correct
34 Correct 12 ms 376 KB Output is correct
35 Correct 4 ms 256 KB Output is correct
36 Correct 12 ms 256 KB Output is correct
37 Correct 24 ms 256 KB Output is correct
38 Correct 112 ms 356 KB Output is correct
39 Execution timed out 1087 ms 256 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 252 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 12 ms 256 KB Output is correct
21 Correct 12 ms 376 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 12 ms 376 KB Output is correct
24 Correct 24 ms 376 KB Output is correct
25 Correct 113 ms 356 KB Output is correct
26 Execution timed out 1048 ms 376 KB Time limit exceeded
27 Halted 0 ms 0 KB -