답안 #1071557

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

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

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

ll T, n, c[N], d[N], a, b;

int 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];
	}

	ll s = 0, ans = p[n];
	for(int i = 1; i <= n; i++){
		s += c[i];
		vector <vector <ll>> dp(n+1, vector <ll> (n+1,1e9));
		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 = 1; j <= n; 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 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 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 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 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Incorrect 1 ms 344 KB Output isn't correct
6 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 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -