Submission #507700

# Submission time Handle Problem Language Result Execution time Memory
507700 2022-01-13T01:56:00 Z oneloveforever Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 304 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=103;
const int MASK=(1<<14);
bool check[N][MASK][N];
const int inf=1e9+7;
int get_mask(int x,int y)
{
    return (x>>y)&1;
}
int main()
{
    int n,need_x,need_y;
    cin>>n>>need_x>>need_y;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++)cin>>a[i];
    if(need_x==1)
    {
        int ans=0;
        for(int i=1;i<=n;i++)ans+=a[i];
        cout<<ans;
        return 0;
    }
    vector<int>sum(n+1);
    for(int i=1;i<=n;i++)sum[i]=sum[i-1]+a[i];
    int maxv=sum[n];
    memset(check,0,sizeof(check));
    check[0][0][0]=true;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=i;j++)
        {
            int res=sum[i]-sum[j-1];
            for(int num=1;num<=need_y;num++)
            {
                for(int mask=0;mask<=maxv;mask++)
                {
                    if(check[j-1][mask][num-1]==false)continue;
                    int value=mask|res;
                    check[i][value][num]=true;
                    //cout<<check[i][value][num]<<" "<<i<<" "<<value<<" "<<num<<endl;
                }
            }
        }
    }
    int ans=inf;
    for(int i=need_x;i<=need_y;i++)
    {
        for(int mask=0;mask<=maxv;mask++)
        {
            if(check[n][mask][i])ans=min(ans,mask);
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -