답안 #1109857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109857 2024-11-07T20:21:02 Z Rainmaker2627 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 508 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int inf=1e18;

signed main() {
	cin.tie(0)->sync_with_stdio(false);

	int n, a, b;
	cin >> n >> a >> b;
	vector<int> pre(n+1, 0);
	for (int i = 1; i <= n; ++i) {
		cin >> pre[i];
		pre[i]+=pre[i-1];
	}

	vector<vector<int>> dp(n+1, vector<int>(b+1, inf));
	for (int i = 0; i <= n; ++i) dp[i][0]=pre[i];
	for (int k = 1; k <= b; ++k) {
		for (int i = k; i <= n; ++i) {
			for (int j = k-1; j < i; ++j) {
				dp[i][k]=min(dp[i][k], dp[j][k-1]|(pre[i]-pre[j]));
			} //cout << dp[i][k] << ' ';
		} //cout << '\n';
	} //cout << '\n';

	int m=inf;
	for (int i = a-1; i < b; ++i) {
		m=min(m, dp[n][i]);
	} cout << m << '\n';

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB Output is correct
2 Incorrect 1 ms 508 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -