Submission #582443

# Submission time Handle Problem Language Result Execution time Memory
582443 2022-06-23T19:20:14 Z angelo_torres Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define f(i,j,n) for(ll i = j; i < n; ++i)
#define fd(i,j,n) for(i = j; i < n; ++i)
#define fr(i,j,n) for(ll i = j; i >= n; --i)
#define sz(v) (ll) v.size()
#define ff first
#define ss second

using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

const int N = 2e3 + 50;
const int M = 1e6 + 20;
const ll mod = 998244353;
const ll inf = 1e14;

ll n,a,b,y[N];

void solve1(){
	ll dp[105][105];
	ll k = b;
	f(i,0,n+1){
		f(j,0,k+1) dp[i][j] = inf;
	}
	dp[0][1] = 0;
	f(i,1,n+1) dp[i][1] = dp[i-1][1]+y[i];
	f(j,2,k+1){
		f(i,j,n+1){
			ll lg = y[i];
			fr(r,i-1,j-1){
				dp[i][j] = min(dp[i][j],dp[r][j-1]|lg);
				lg += y[r]; 
			}
		}
	}
	ll ans = inf;
	f(i,a,b+1) ans = min(dp[n][i],ans);
	cout << ans << endl;
}

void solve(){
	cin >> n >> a >> b;
	f(i,1,n+1) cin >> y[i];
	if(n <= 100){
		solve1();
	}
}

int main(){
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	int tc = 1;
	// cin >> tc;
	while(tc--) solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -