Submission #742308

# Submission time Handle Problem Language Result Execution time Memory
742308 2023-05-16T05:30:40 Z viwlesxq Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 320 KB
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef string str;

const int N = 2e3 + 1;
const ll inf = 1e18;

ll y[N];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n; ++i) {
        cin >> y[i];
    }
    ll ans = inf;
    for (int mask = 0; mask < (1 << (n - 1)); ++mask) {
        int cnt = __builtin_popcount(mask);
        if (cnt < a || cnt > b) {
            continue;
        }
        ll cur = 0;
        ll sum = y[0];
        for (int bit = 0; bit < n - 1; ++bit) {
            if (mask & (1 << bit)) {
                sum += y[bit + 1];
            } else {
                cur |= sum;
                sum = y[bit + 1];
            }
        }
        cur |= sum;
        ans = min(ans, cur);
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -