답안 #152391

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152391 2019-09-07T21:04:32 Z beso123 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 380 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,A,B,pref[2002],a[2002],dp[2002][2002];
main(){
cin>>n>>A>>B;
for(int k=1;k<=n;k++){
    cin>>a[k];
    pref[k]=a[k]+pref[k-1];
}
for(int k=1;k<=n;k++)
    dp[1][k]=pref[k];
    int ans=pref[n];
for(int k=2;k<=B;k++){
   for(int i=k;i<=n;i++){
        dp[k][i]=INT_MAX;
        for(int j=1;j<=i-k+1;j++){
           int h=dp[k-1][j] | (pref[i]-pref[j]);
           dp[k][i]=min(dp[k][i],h);
        }
    }
    ans=min(ans,dp[k][n]);
}
cout<<ans;
return 0;
}
/*
6 1 3
8 1 2 1 5 4
*/

Compilation message

sculpture.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -