Submission #774409

# Submission time Handle Problem Language Result Execution time Memory
774409 2023-07-05T17:30:57 Z OrazB Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 328 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
//Dijkstra->set
//set.find_by_order(x) x-position value
//set.order_of_key(x) number of strictly less elements don't need *set.??
#define N 100005
#define wr cout << "Continue debugging\n";
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define pii pair <int, int>
#define pb push_back
#define ff first
#define ss second

const ll inf = 1e18;
int a[N];
ll pref[N];

int main ()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, A, B;
	cin >> n >> A >> B;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
		pref[i] = pref[i-1]+a[i];
	}
	vector<vector<ll>> dp(n+1, vector<ll>(n+1, inf));
	dp[1][1] = a[1];
	for (int i = 2; i <= n; i++){
		dp[i][1] = dp[i-1][1]+a[i];
	}
	for (int j = 2; j <= B; j++){
		for (int i = j; i <= n; i++){
			ll sum = 0;
			for (int k = i; k >= j; k--){
				sum += a[k];
				dp[i][j] = min(dp[i][j], sum|dp[k-1][j-1]);
			}
		}
	}
	ll mn = inf;
	for (int i = A; i <= B; i++) mn = min(mn, dp[n][i]);
	cout << mn << '\n';
}	
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Incorrect 1 ms 328 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -