Submission #670905

#TimeUsernameProblemLanguageResultExecution timeMemory
670905Dan4LifeBali Sculptures (APIO15_sculpture)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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];
      |       ^~~