답안 #742309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742309 2023-05-16T05:31:40 Z viwlesxq Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 328 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) + 1;
        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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 0 ms 324 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 0 ms 328 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Incorrect 1 ms 320 KB Output isn't correct
6 Halted 0 ms 0 KB -