Submission #185642

#TimeUsernameProblemLanguageResultExecution timeMemory
185642dndhkBali Sculptures (APIO15_sculpture)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAX_N = 100; const int INF = 10000000; int N, A, B; vector<ll> v; ll dp[MAX_N+1][MAX_N+1]; ll sum[MAX_N+1]; ll ans; ll sum(ll x, ll y){ return dp[1][y] - dp[1][x-1]; } int main(){ scanf("%d%d%d", &N, &A, &B); v.pb(0LL); for(int i=1 ;i<=N; i++){ ll x; scanf("%lld", &x); v.pb(x); } for(int i=1; i<=N; i++){ dp[1][i] = dp[1][i-1] + v[i]; } for(int k=2; k<=N; k++){ for(int i=k; i<=N; i++){ dp[k][i] = (v[i] | dp[k-1][i-1]); for(int j=i-1; j>=k; j--){ dp[k][i] = min(dp[k][i], (sum(j, i) | dp[k-1][j-1])); } //cout<<k<<" "<<i<<" "<<dp[k][i]<<endl; } } ans = dp[A][N]; for(int i=A; i<=B; i++){ ans = min(ans, dp[i][N]); } cout<<ans; return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'll sum(ll, ll)':
sculpture.cpp:20:18: error: 'll sum(ll, ll)' redeclared as different kind of symbol
 ll sum(ll x, ll y){
                  ^
sculpture.cpp:17:4: note: previous declaration 'll sum [101]'
 ll sum[MAX_N+1];
    ^~~
sculpture.cpp: In function 'int main()':
sculpture.cpp:38:39: error: 'sum' cannot be used as a function
     dp[k][i] = min(dp[k][i], (sum(j, i) | dp[k-1][j-1]));
                                       ^
sculpture.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &N, &A, &B);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   ll x; scanf("%lld", &x);
         ~~~~~^~~~~~~~~~~~