Submission #244196

# Submission time Handle Problem Language Result Execution time Memory
244196 2020-07-02T18:42:17 Z jovan_b Bali Sculptures (APIO15_sculpture) C++17
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

ll dp[2005][2005];
ll niz[2005];
const ll INF = 1000000000000000LL;

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, a, b;
    cin >> n >> a >> b;
    for(int i=1; i<=b; i++) dp[0][i] = INF;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
        for(int j=0; j<=b; j++) dp[i][j] = INF;
        ll sum = 0;
        for(int j=i; j>=1; j--){
            sum += niz[j];
            for(int k=1; k<=b; k++) dp[i][k] = min(dp[i][k], dp[j-1][k-1] | sum);
        }
    }
    ll res = dp[n][b];
    for(int i=a; i<=b; i++) res = min(res, dp[n][i]);
    cout << dp[n][b] << "\n";
    return 0;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -