Submission #883338

# Submission time Handle Problem Language Result Execution time Memory
883338 2023-12-05T07:40:49 Z SalihSahin Bali Sculptures (APIO15_sculpture) C++14
0 / 100
0 ms 348 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;
    vector<vector<int> > dp(n+1, vector<int>(n+1, 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 <= i; j++){
            for(int k = i+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]);
    }
    if(ans == inf){
        int cnt = 0;
        for(int i = 0; i < inf; i++){
            cnt++;
        }
    }
    else cout<<ans<<endl;
    return 0;
}
# 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 344 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 344 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 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -