Submission #523691

# Submission time Handle Problem Language Result Execution time Memory
523691 2022-02-08T04:21:58 Z Gurban Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

const int maxn=2e3+5;
int n,A,B;
int a[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> A >> B;
	for(int i = 1;i <= n;i++) cin >> a[i];

	ll ans = 0;
	for(ll i = 32;i >= 0;i--){
		ll now = ans + (1 << i) - 1;
		vector<int>dp(n + 1,1e9);
		dp[0] = 0;
		for(int j = 1;j <= n;j++){
			ll sum = 0;
			for(int k = j;k >= 1;k--){
				sum += a[k];
				if((sum & now) == sum) dp[j] = min(dp[j],dp[k - 1] + 1);
			}
		}
		if(dp[n] > B) ans += (1ll << i); 
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -