답안 #27457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27457 2017-07-13T04:43:31 Z TAMREF Bali Sculptures (APIO15_sculpture) C++11
0 / 100
0 ms 33320 KB
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int mx=2005;
int N,A,B;
ll S[mx];
void input(){
    scanf("%d%d%d",&N,&A,&B);
    for(int i=1;i<=N;i++){
        scanf("%llu",&S[i]);
        S[i]+=S[i-1];
    }
}
void solve_n3(){
    ll dp3[mx][mx];
    for(int j=0;j<=N;j++) dp3[0][j]=0;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++)
            dp3[i][j]=ULLONG_MAX;
    }
    dp3[1][1]=S[1];
    for(int i=2;i<=N;i++){
        for(int j=1;j<=i;j++)
            for(int k=j-1;k<i;k++){
                dp3[i][j]=min(dp3[i][j],dp3[k][j-1]|(S[i]-S[k]));
                //printf("dp[%d][%d]=%llu\n",i,j,dp3[i][j]);
            }
    }
    //for(int x=1;x<=N;x++,puts("")) for(int i=1;i<=N;i++) printf("%llu ",dp3[x][i]);
    printf("%llu\n",*min_element(dp3[N]+A+1,dp3[N]+B+2));
}
int main(){
    input();
    solve_n3();
}

Compilation message

sculpture.cpp: In function 'void input()':
sculpture.cpp:8:29: 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:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%llu",&S[i]);
                            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33316 KB Output is correct
2 Incorrect 0 ms 33320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33312 KB Output is correct
2 Incorrect 0 ms 33316 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33316 KB Output is correct
2 Incorrect 0 ms 33320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33320 KB Output is correct
2 Incorrect 0 ms 33316 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33316 KB Output is correct
2 Incorrect 0 ms 33316 KB Output isn't correct
3 Halted 0 ms 0 KB -