답안 #129359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129359 2019-07-12T05:06:45 Z arnold518 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 376 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 = 1e17;

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];

    dp[1][0]=INF;
    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 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 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 256 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 -