답안 #455102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
455102 2021-08-05T12:33:21 Z qwerasdfzxcl Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
int a[2020];
ll dp[2020][2020];

int main(){
    int n, l, r;
    scanf("%d %d %d", &n, &l, &r);
    for (int i=1;i<=n;i++) scanf("%d", a+i);
    for (int i=1;i<=n;i++){
        dp[i][1] = dp[i-1][1]+a[i];
        for (int j=2;j<=i;j++){
            dp[i][j] = 1e18;
            ll cur = 0;
            for (int k=i;k>j-1;k--){
                cur += a[k];
                dp[i][j] = min(dp[i][j], dp[k-1][j-1]|cur);
            }
        }
        /*for (int j=1;j<=i;j++) printf("%lld ", dp[i][j]);
        printf("\n");*/
    }
    ll ans = 1e18;
    for (int i=l;i<=r;i++) ans = min(ans, dp[n][i]);
    printf("%lld\n", ans);
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d %d", &n, &l, &r);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:11:33: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i=1;i<=n;i++) scanf("%d", a+i);
      |                            ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -