Submission #620577

# Submission time Handle Problem Language Result Execution time Memory
620577 2022-08-03T07:18:27 Z daisy2 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 324 KB
#include<iostream>
#define endl '\n'
using namespace std;
long long n,a,b,m[2005],pref[2005];
const long long MAXIM=1000000000000;
long long fin(int p,long long tr,int brg)
{
    if(p==0)
    {
        if(brg>=a && brg<=b) {return 0;}
        return MAXIM;
    }
    long long r=MAXIM,trn;
    for(int i=p-1;i>=0;i--)
    {
        trn=tr|(pref[p]-pref[i]);
        r=min((fin(i,trn,brg+1)|trn),r);
    }
    return r;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>a>>b;

    for(int i=1;i<=n;i++)
    {
        cin>>m[i];
        pref[i]=m[i]+pref[i-1];
    }

    if(a==1)
    {
        cout<<pref[n]<<endl;
        return 0;
    }
    cout<<fin(n,0,0)<<endl;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -