Submission #883342

# Submission time Handle Problem Language Result Execution time Memory
883342 2023-12-05T07:51:58 Z SalihSahin Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 600 KB
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
 
using namespace std;
const int inf = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main(){
    ios_base::sync_with_stdio(false), cin.tie();
    int n, a, b;
    cin>>n>>a>>b;
    int dp[n+1][n+1];
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            dp[i][j] = inf;
        }
    }
    dp[0][0] = 0;
    vector<int> arr(n+1), pre(n+1);
    for(int i = 1; i <= n; i++){
        cin>>arr[i];
        pre[i] = pre[i-1] + arr[i];
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = j + 1; k <= n; k++){
                dp[k][j+1] = min(dp[k][j+1], dp[i][j]|(pre[k] - pre[i]));
            }
        }
    }

    int ans = inf;
    for(int i = a; i <= b; i++){
        ans = min(ans, dp[n][i]);
    }

    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -