Submission #499385

# Submission time Handle Problem Language Result Execution time Memory
499385 2021-12-28T09:46:15 Z Stickfish Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 332 KB
#include <iostream>
#include <cassert>
using namespace std;
using ll = long long;

const int MAXN = 2077;
const ll INF = 1.77013e18;
ll a[MAXN];

signed main() {
    int n, A, B;
    cin >> n >> A >> B;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    ll ans = INF;
    for (int m = (1ll << (n - 1)); m < (1ll << n); ++m) {
        int cnt = __builtin_popcount(m);
        if (A > cnt || cnt > B)
            continue;
        ll sm = 0;
        ll ans_ = 0;
        for (int i = 0; i < n; ++i) {
            sm += a[i];
            if (m & (1 << i)) {
                ans_ |= sm;
                sm = 0;
            }
        }
        ans = min(ans, ans_);
    }
    if (ans == INF) {
        assert(0);
    }

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 2 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 33 ms 276 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 296 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 6 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 4 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 4 ms 204 KB Output is correct
26 Correct 30 ms 324 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 292 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 4 ms 204 KB Output is correct
32 Correct 2 ms 204 KB Output is correct
33 Correct 27 ms 204 KB Output is correct
34 Correct 29 ms 204 KB Output is correct
35 Correct 3 ms 204 KB Output is correct
36 Correct 29 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 2 ms 296 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 292 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 30 ms 272 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 292 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 292 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 4 ms 204 KB Output is correct
22 Correct 4 ms 204 KB Output is correct
23 Correct 5 ms 204 KB Output is correct
24 Correct 3 ms 304 KB Output is correct
25 Correct 6 ms 204 KB Output is correct
26 Correct 29 ms 292 KB Output is correct
27 Correct 62 ms 208 KB Output is correct
28 Correct 206 ms 276 KB Output is correct
29 Execution timed out 1091 ms 204 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 31 ms 204 KB Output is correct
14 Correct 63 ms 276 KB Output is correct
15 Correct 202 ms 276 KB Output is correct
16 Execution timed out 1088 ms 204 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 296 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 2 ms 292 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 33 ms 276 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 296 KB Output is correct
21 Correct 4 ms 204 KB Output is correct
22 Correct 4 ms 204 KB Output is correct
23 Correct 4 ms 204 KB Output is correct
24 Correct 3 ms 296 KB Output is correct
25 Correct 4 ms 272 KB Output is correct
26 Correct 34 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 292 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 4 ms 204 KB Output is correct
32 Correct 2 ms 204 KB Output is correct
33 Correct 27 ms 204 KB Output is correct
34 Correct 28 ms 204 KB Output is correct
35 Correct 2 ms 204 KB Output is correct
36 Correct 28 ms 204 KB Output is correct
37 Correct 57 ms 204 KB Output is correct
38 Correct 203 ms 276 KB Output is correct
39 Execution timed out 1087 ms 204 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 292 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 30 ms 324 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 296 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 4 ms 204 KB Output is correct
19 Correct 2 ms 204 KB Output is correct
20 Correct 31 ms 204 KB Output is correct
21 Correct 31 ms 204 KB Output is correct
22 Correct 2 ms 292 KB Output is correct
23 Correct 29 ms 276 KB Output is correct
24 Correct 58 ms 204 KB Output is correct
25 Correct 202 ms 276 KB Output is correct
26 Execution timed out 1079 ms 204 KB Time limit exceeded
27 Halted 0 ms 0 KB -