Submission #563429

#TimeUsernameProblemLanguageResultExecution timeMemory
563429penguin133Bali Sculptures (APIO15_sculpture)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int A[200005] ,P[200005]; int dp[2005][2005]; main(){ ios::sync_with_stdio(0);cin.tie(0); int n,a,b; cin >> n >> a >> b; for(int i=1;i<=n;i++)cin >> A[i], P[i] = P[i-1] + A[i]; for(int i=1;i<=n;i++)dp[0][i] = dp[i][0] = 2e9; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ dp[i][j] = 2e9; if(j > i)continue; for(int k=i-1;k>=0;k--){ dp[i][j] = min(dp[i][j], (dp[k][j-1] | (P[i] - P[k]))); } } } /* for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++)cout << dp[i][j] << " "; cout << '\n'; } */ int ans = 2e9; for(int i=a;i<=b;i++)ans = min(ans, dp[n][i]); cout << ans << '\n'; //cout << (8|1) << '\n'; }

Compilation message (stderr)

sculpture.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...