Submission #102424

# Submission time Handle Problem Language Result Execution time Memory
102424 2019-03-24T21:45:12 Z Darksinian Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
int Arr[N],pre[N];
int dp[N][N];
int main()
{
    ios_base::sync_with_stdio(false);
    int n,a,b;
    cin >> n >> a >> b;
    for(int i =1;i<=n;i++) cin >> Arr[i];
    for(int i =1;i<=n;i++) {
        pre[i] = pre[i-1] + Arr[i];
    }
    for(int i=1;i<=n;i++) dp[0][i] = pre[i];
    int ans = 2e9;
    for(int i =1;i<=b;i++) {
        for(int j =1;j<=n;j++) {
            dp[i][j] = 2e9;
            for(int s = j-1;s>0;s--) {
                dp[i][j] = min(dp[i][j],(pre[j] - pre[s]) | dp[i-1][s]);
            }
        }
        if(i >= a || i <=b) ans = min(ans,dp[i][n]);
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -