답안 #670905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670905 2022-12-11T10:01:37 Z Dan4Life Bali Sculptures (APIO15_sculpture) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = (int)1e2+10;
const int LINF = (int)1e18;
int n, A, B, ans=LINF;
int a[maxn], pre[maxn];
short int dp[maxn][maxn][maxn][32];

void recur(int pos, int lpos, int knum, int Or){
	if(dp[pos][lpos][knum][Or]!=-1) return;
	dp[pos][lpos][knum][Or]=1;
	if(pos==n+1) return;
	if(pos!=n) recur(pos+1, lpos, knum, Or);
	recur(pos+1, pos, knum+1, Or|(pre[pos]-pre[lpos]));
}

int32_t main() {
	cin >> n >> A >> B; memset(dp,-1,sizeof(dp));
	for(int i = 0; i < n; i++) cin >> a[i], pre[i+1]=pre[i]+a[i];
	recur(1,0,1,0);
	for(int i = A+1; i <= B+1; i++)
		for(int k = 0; k < 32; k++)
			if(dp[n+1][n][i][k]==1) ans = min(ans, k);
	cout << ans;
}

Compilation message

sculpture.cpp:3:13: error: 'long' and 'short' specified together
    3 | #define int long long
      |             ^~~~
sculpture.cpp:8:7: note: in expansion of macro 'int'
    8 | short int dp[maxn][maxn][maxn][32];
      |       ^~~