답안 #698137

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698137 2023-02-12T12:47:54 Z ToroTN Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,a,b,arr[2005],dp[105][105],val[105][105],ans;
int main()
{
    scanf("%lld%lld%lld",&n,&a,&b);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    if(n<=100)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=i;j<=n;j++)
            {
                val[i][j]=0;
                for(int k=i;k<=j;k++)
                {
                    val[i][j]+=arr[k];
                }
                //printf("%lld %lld %lld\n",i,j,val[i][j]);
            }
        }
        for(int i=0;i<=100;i++)for(int j=0;j<=100;j++)dp[i][j]=1e18;
        dp[0][0]=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=i;j++)
            {
                for(int k=0;k<i;k++)
                {
                    dp[i][j]=min(dp[i][j],(dp[k][j-1]|val[k+1][i]));
                }
                //printf("%d %d %lld\n",i,j,dp[i][j]);
            }
        }
        ans=1e18;
        for(int i=a;i<=b;i++)ans=min(ans,dp[n][i]);
        printf("%lld\n",ans);
    }else
    {

    }
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld%lld%lld",&n,&a,&b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%lld",&arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -