답안 #1071562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071562 2024-08-23T08:48:44 Z Muhammet Bali Sculptures (APIO15_sculpture) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define sz(x) (int)x.size()
#define ff first
#define ss second

const int N = 305;
const int M = 1e9 + 7;

int T, n, c[N], a, b;

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

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

	int s = 0, ans = 1e18;
	for(int i = 1; i <= n; i++){
		s += c[i];
		vector <vector <int>> dp(n+1, vector <int> (n+1,1e18));
		for(int j = i+1; j <= n; j++){
			dp[j][1] = (p[j]-p[i])|s;
			for(int j1 = j-1; j1 > i; j1--){
				for(int ste = 1; ste < n; ste++){
					dp[j][ste+1] = min(dp[j][ste+1],(dp[j1][ste]|(p[j]-p[j1]))|s);
				}
			}
		}
		for(int j = a-1; j < b; j++){
			ans = min(ans,dp[n][j]);
		}
	}

	cout << ans << "\n";

	return 0;
}
// 6 1 3
// 8 1 2 1 5 4
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -