답안 #378731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378731 2021-03-17T03:36:01 Z saarang123 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
23 ms 31724 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxn = 2002;
int dp[mxn][mxn], y[mxn], p[mxn];
signed main() {
    std::ios::sync_with_stdio(0);
    std::cout.tie(0);
    std::cin.tie(0);
    #ifdef saarang
    freopen("/home/saarang/Documents/cp/input.txt", "r", stdin);
    freopen("/home/saarang/Documents/cp/output.txt", "w", stdout);
    #endif
    int n, a, b;
    cin >> n >> a >> b;
    for(int i = 1; i <= n; i++)
    	cin >> y[i];
    for(int i = 1; i <= n; i++)
    	p[i] = p[i - 1] + y[i];
    memset(dp, 0x7f, sizeof dp);
    dp[0][0] = 0;
    for(int i = 1; i <= n; i++) {
    	for(int j = 1; j <= i; j++) {
    		int sum = 0;
    		for(int k = i; k; k--) {
    			sum += y[k];
    			dp[i][j] = min(dp[i][j], dp[k - 1][j - 1] | sum);
    		}
    	}
    }
    int ans = 1e15;
    for(int j = a; j <= b; j++)
    		ans = min(ans, dp[n][j]); 
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 31724 KB Output is correct
2 Incorrect 21 ms 31724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 31724 KB Output is correct
2 Incorrect 18 ms 31724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 31724 KB Output is correct
2 Incorrect 18 ms 31724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 31724 KB Output is correct
2 Incorrect 18 ms 31724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 31724 KB Output is correct
2 Incorrect 18 ms 31724 KB Output isn't correct
3 Halted 0 ms 0 KB -