답안 #602440

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602440 2022-07-23T06:07:06 Z snasibov05 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 300 KB
#include <bits/stdc++.h>

using namespace std;

#define oo 1000000000000000000ll

int main() {
    int n, a, b; cin >> n >> a >> b;
    vector<int> y(n+1);
    for (int i = 1; i <= n; ++i) cin >> y[i];

    vector<long long> pref(n+1);
    for (int i = 1; i <= n; ++i) pref[i] = pref[i-1] + 1ll*y[i];

    vector<vector<long long>> dp(n+1, vector<long long>(b+1, oo)); dp[0][0] = 0;
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= min(i, b); ++j){
            for (int prev = 0; prev < i; ++prev){
                dp[i][j] = min(dp[i][j], dp[prev][j-1] | (pref[i] - pref[prev]));
            }
        }
    }

    long long ans = oo;
    for (int i = a; i <= b; ++i) ans = min(ans, dp[n][i]);

    cout << ans << "\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 296 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -