답안 #499384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499384 2021-12-28T09:44:34 Z Stickfish Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 460 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) {
        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_);
    }
    if (ans == INF) {
        assert(0);
    }

    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Runtime error 1 ms 460 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -