답안 #40461

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40461 2018-02-01T21:09:31 Z MatheusLealV Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 712 KB
#include <bits/stdc++.h>
#define N 2005
using namespace std;
typedef long long ll;

int n, A, B, v[N];

ll dp[N][N], sum[N], ans;

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

	cin>>n>>A>>B;

	for(int i = 1; i <= n; i++) cin>>v[i], sum[i] = sum[i - 1] + (ll)v[i], dp[i][1] = sum[i];

	for(int k = 2; k <= B; k++)
	{
		for(int i = 1; i <= n; i++)
		{
			dp[i][k] = 200000000000000000LL;

			for(int j = 1; j <= i; j++)
			{
				//if(j < k - 1) continue;

				dp[i][k] = min( (dp[j - 1][k - 1] | (sum[i] - sum[j - 1])), dp[i][k]);

				//cout<<dp[j - 1][k - 1]<<" "<<(sum[i] - sum[j - 1])<<" "<<(dp[j - 1][k - 1] | (sum[i] - sum[j - 1]))<<"\n";
			}

			if(A <= k && k <= B && i == n) ans = max(ans, dp[i][k]);

			//cout<<i<<" "<<k<<" "<<dp[i][k]<<"\n";
		}
	}

	cout<<ans<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 1 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 560 KB Output is correct
2 Incorrect 2 ms 560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 560 KB Output is correct
2 Incorrect 2 ms 560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 560 KB Output is correct
2 Incorrect 2 ms 560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 580 KB Output is correct
2 Incorrect 1 ms 712 KB Output isn't correct
3 Halted 0 ms 0 KB -