Submission #168120

# Submission time Handle Problem Language Result Execution time Memory
168120 2019-12-11T13:06:57 Z mat_v Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
#define maxn 2005
#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define inf 1e15
using namespace std;
typedef long long ll;
ll niz[maxn];
ll dp[maxn][maxn];
int n;
ll pref[maxn];
ll a,b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> a >> b;
    for(int i=1; i<=n; i++)cin >> niz[i];
    pref[0] = 0;
    for(int i=1; i<=n; i++)pref[i] = pref[i - 1] + niz[i];
    if(1){
        for(int i=1;i <=n; i++){
            dp[0][i] = inf;
        }
        for(int i=1; i<=n; i++){
            for(int j=0; j<=b; j++){
                dp[i][j] = inf;
                if(j == 0)dp[i][j] = pref[i];
                if(j == 0)continue;
                for(int k=0; k<=i - 1; k++){
                    dp[i][j] = min(dp[k][j - 1] | (pref[i] - pref[k]), dp[i][j]);
                }
            }
        }
        ll mini = inf;
        for(int i=a; i<=b; i++)mini = min(mini, dp[n][i]);
        cout << mini << endl;
        return 0;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -