제출 #49913

#제출 시각아이디문제언어결과실행 시간메모리
49913kjain_1810Bali Sculptures (APIO15_sculpture)C++17
0 / 100
2 ms512 KiB
#include<bits/stdc++.h>

using namespace std;
const int N=1e2+5;
long long arr[N], dp[N][N], n, m, A, B, pref[N];
//dp[i][j]==dividing first i numbers in j parts
int main()
{
    #define int long long
    scanf("%lld%lld%lld", &n, &A, &B);
    for(int a=1; a<=n; a++)
        scanf("%d", &arr[a]);
    for(int a=1; a<=n; a++)
        pref[a]=pref[a-1]+arr[a];
    for(int a=1; a<=n; a++)
        dp[a][1]=pref[a];
    int ans=1e18;
    if(A==1)
        ans=dp[n][1];
    for(int a=2; a<=B; a++)
    {
        for(int b=1; b<=n; b++)
        {
            dp[b][a]=1e18;
            for(int c=b-1; c>=1; c--)
                dp[b][a]=min(dp[b][a], (dp[c][a-1]|(pref[b]-pref[c]) ));
        }
        if(a>=A)
            ans=min(ans, dp[n][a]);
    }
    printf("%lld\n", ans);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

sculpture.cpp: In function 'int main()':
sculpture.cpp:12:28: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d", &arr[a]);
                     ~~~~~~~^
sculpture.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld", &n, &A, &B);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &arr[a]);
         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...