Submission #908109

# Submission time Handle Problem Language Result Execution time Memory
908109 2024-01-16T08:00:02 Z treap_enjoyer Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast,unroll-loops")

#define ll long long
#define all(x) x.begin(), x.end()
#define ld long double
#define pii pair<int, int>

using namespace std;
using namespace __gnu_pbds;

template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const ll INF = 1e15 + 7;
const int MAXN = 1e5 + 5;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> ar(n + 1);
    vector<ll> pref(n + 1, 0);
    for(int i = 1; i <= n; i++){
        cin >> ar[i];
        pref[i] += pref[i - 1];
        pref[i] += ar[i];
    }
    vector<vector<ll> > dp(n + 1, vector<ll>(b + 1, INF));
    for(int i = 1; i <= n; i++){
        dp[i][1] = pref[i];
    }
    for(int i = 2; i <= b; i++){
        for(int j = 2; j <= n; j++){
            for(int k = 1; k < j; k++){
                dp[j][i] = min(dp[j][i], dp[k][i - 1] | (pref[j] - pref[k]));
            }
        }
    }
    cout << dp[n][b] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 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 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -