답안 #129352

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129352 2019-07-12T04:50:08 Z arnold518 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 100;
const ll INF = numeric_limits<ll>::max();

int N, A, B;
ll Y[MAXN+10], dp[MAXN+10][MAXN+10], ans=INF;

int main()
{
    int i, j, k;
    scanf("%d%d%d", &N, &A, &B);
    for(i=1; i<=N; i++) scanf("%lld", &Y[i]), Y[i]+=Y[i-1];

    for(i=1; i<=N; i++) dp[1][i]=Y[i];
    for(i=2; i<=N; i++)
    {
        for(j=1; j<=N; j++)
        {
            dp[i][j]=INF;
            for(k=1; k<j; k++)
            {
                dp[i][j]=min(dp[i][j], dp[i-1][k]|(Y[j]-Y[k]));
            }
        }
    }
    for(i=A; i<=B; i++) ans=min(ans, dp[i][N]);
    printf("%lld", ans);
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:17:10: 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:18:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) scanf("%lld", &Y[i]), Y[i]+=Y[i-1];
                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 256 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 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 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 -