Submission #629786

# Submission time Handle Problem Language Result Execution time Memory
629786 2022-08-15T06:25:50 Z aebov Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 212 KB
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#define ll long long
#define pb push_back
using namespace std;
 
ll dp[2001];
int n,a,b,y[2001];
ll inf = (1LL<<57);
ll ans = (1LL<<57)-1;
bool f()
{
	for(int i=0;i<=n;i++)dp[i]=inf;
	dp[0]=0;
	for(int i=0;i<n;i++){
		ll sum=0;
		for(int j=i;j<n;j++)
		{
			sum += y[j];
			if((sum|ans)==ans)dp[j + 1] = min(dp[j + 1], 1 + dp[i]);
		}
	}
	return dp[n]<=b;
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)cin>>y[i];

	for(int i=56;i>=0;i--){
		ans^=(1LL<<i);
		if(f())ans|=(1LL<<i);
	}
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -