답안 #202000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
202000 2020-02-13T02:54:12 Z mdn2002 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
24 ms 33272 KB
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long n,y[2050],dp[2050][2050],a,b;
long long f(int x,int g)
{
    if(x==n&&a<=g&&g<=b)return 0;
    if(x==n)return 1e18;
    if(dp[x][g]!=-1)return dp[x][g];
    long long ans=1e18,sum=0;
    for(int i=x;i<n;i++)
    {
        sum+=y[i];
        ans=min(ans,(f(i+1,g+1)|sum));
    }
    return dp[x][g]=ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("empty.in","r",stdin);
    //freopen("empty.out","w",stdout);
    memset(dp,-1,sizeof dp);
    cin>>n>>a>>b;
    for(int i=0;i<n;i++)cin>>y[i];
    long long ans=f(0,1);
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 33272 KB Output is correct
2 Correct 23 ms 33272 KB Output is correct
3 Incorrect 24 ms 33272 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 33272 KB Output is correct
2 Correct 23 ms 33272 KB Output is correct
3 Incorrect 23 ms 33272 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 33272 KB Output is correct
2 Correct 23 ms 33272 KB Output is correct
3 Incorrect 23 ms 33272 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 33272 KB Output is correct
2 Correct 23 ms 33272 KB Output is correct
3 Incorrect 23 ms 33272 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 33272 KB Output is correct
2 Correct 23 ms 33272 KB Output is correct
3 Incorrect 24 ms 33272 KB Output isn't correct
4 Halted 0 ms 0 KB -