답안 #77097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
77097 2018-09-21T07:17:48 Z MrTEK Bali Sculptures (APIO15_sculpture) C++14
0 / 100
10 ms 8456 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define len(a) (int)a.size()
#define fi first
#define sc second
#define d1(w) cerr<<#w<<":"<<w<<endl;
#define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl;
#define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl;
#define left ind+ind
#define right ind+ind+1
#define mid (l+r)/2
#define endl '\n'
#define bit __builtin_popcount

typedef long long int ll;

const int maxn = 620;
const long long LINF = (1ll << 64) - 1;
const int LOG = 31;
const int INF = 1e9 + 5;
const int P = 31;
const int ALP = 22;
const int N = 1e3 + 5;
const int M = 26;
const int SQ = 350;
const int MOD = 1e9 + 7;

typedef long long int lli;
typedef pair<int,int> pii;

int n,x,y,a[N];
ll dp[N][N];

ll f(int cur,int par) {
	if (par > y) return LINF;
	if (cur == n + 1) {
		if (par >= x) return 0;
		return LINF;
	}
	ll &r = dp[cur][par];
	if (r != -1) return r;
	ll sum = 0;
	r = LINF;
	for (int i = cur; i <= n ; i++) {
		sum += a[i];
		r = min(r,sum | f(i + 1,par + 1));
	}
	return r;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	cin >> n >> x >> y;
	for (int i = 1 ; i <= n ; i++)
		cin >> a[i];
	memset(dp,-1,sizeof dp);
	cout << f(1,0) << endl;

}

Compilation message

sculpture.cpp:20:32: warning: left shift count >= width of type [-Wshift-count-overflow]
 const long long LINF = (1ll << 64) - 1;
                                ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 8312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 8456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 8456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 8456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 8456 KB Output isn't correct
2 Halted 0 ms 0 KB -