Submission #90595

# Submission time Handle Problem Language Result Execution time Memory
90595 2018-12-22T19:20:25 Z 314rate Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 972 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=2000+5;

int n,a,b;
int v[N];
ll pre[N];
ll kek[105][105];

ll ask(int st,int dr)
{
    return pre[dr]-pre[st-1];
}

void b100()
{
    for(int i=1;i<=n;i++)
    {
        kek[i][1]=ask(1,i);
        for(int j=2;j<=i;j++)
        {
            kek[i][j]=(1LL<<60);
            for(int k=j-1;k<i;k++)
            {
                kek[i][j]=min(kek[i][j],(kek[k][j-1]|ask(k+1,i)));
            }
        }
    }
}

int mabit(ll x)
{
    for(int i=60;i>=0;i--)
    {
        if(x&(1LL<<i))
        {
            return i;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        pre[i]=pre[i-1]+v[i];
    }

    if(n<=100)
    {
        b100();
        ll ans=(1LL<<60);
        for(int j=a;j<=b;j++)
        {
            ans=min(ans,kek[n][j]);
        }
        cout<<ans<<"\n";
        return 0;
    }
    return 0;
}
/**

6 1 3
8 1 2 1 5 4

8 4 2 1
1 0 0 0
0 0 0 1
0 0 1 0
0 0 0 1
0 1 0 1
0 1 0 0


11

8 4 2 1
1 0 1 1

**/

Compilation message

sculpture.cpp: In function 'int mabit(ll)':
sculpture.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
2 Incorrect 2 ms 728 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 972 KB Output is correct
2 Incorrect 2 ms 972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 972 KB Output is correct
2 Incorrect 2 ms 972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 972 KB Output is correct
2 Incorrect 2 ms 972 KB Output isn't correct
3 Halted 0 ms 0 KB -