Submission #499383

# Submission time Handle Problem Language Result Execution time Memory
499383 2021-12-28T09:35:27 Z Stickfish Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 204 KB
#include <iostream>
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 = (1 << n) / 2; m < (1 << n); ++m) {
        ll 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_);
    }
    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 Incorrect 0 ms 204 KB Output isn't correct
4 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 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -