답안 #27458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27458 2017-07-13T04:45:52 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 i=1;i<=N;i++)
        for(int j=0;j<=N;j++)
            dp3[i][j]=ULLONG_MAX;
    for(int j=0;j<=N;j++) dp3[0][j]=0;
    for(int i=1;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,dp3[N]+B+1));
}
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 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 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 33320 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 -