Submission #112123

# Submission time Handle Problem Language Result Execution time Memory
112123 2019-05-17T14:02:46 Z Runtime_error_ Bali Sculptures (APIO15_sculpture) C++14
9 / 100
96 ms 476 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=22,MX=1e18+9;
ll n,x,y,ans=MX,a[inf],pre[inf];

int main(){

    cin>>n>>x>>y;
    for(ll i=0;i<n;i++)
        cin>>a[i],pre[i]=a[i]+(i>0?pre[i-1]:0);

    for(ll i=0;i<(1<<(n-1));i++){
        ll mask=i|(1<<(n-1));
        ll cnt=__builtin_popcountll(mask);
        if(cnt>y || cnt<x)
            continue;

        ll OR=0,last=0;
        for(ll j=0;j<n;j++)
            if((1<<j) & mask )
                OR|=(pre[j]-pre[last]+a[last]),last=j+1;
        ans=min(ans,OR);
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 38 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 19 ms 384 KB Output is correct
21 Correct 8 ms 256 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 7 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 41 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 6 ms 256 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 35 ms 384 KB Output is correct
34 Correct 38 ms 356 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 41 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 39 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 7 ms 384 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 7 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 7 ms 384 KB Output is correct
26 Correct 45 ms 476 KB Output is correct
27 Correct 83 ms 384 KB Output is correct
28 Incorrect 2 ms 256 KB Output isn't correct
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 38 ms 256 KB Output is correct
14 Correct 78 ms 356 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 38 ms 256 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 7 ms 256 KB Output is correct
22 Correct 9 ms 384 KB Output is correct
23 Correct 8 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 6 ms 384 KB Output is correct
26 Correct 35 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 11 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 34 ms 256 KB Output is correct
34 Correct 39 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 39 ms 384 KB Output is correct
37 Correct 77 ms 256 KB Output is correct
38 Incorrect 1 ms 256 KB Output isn't correct
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 356 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 38 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 6 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 35 ms 376 KB Output is correct
21 Correct 38 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 38 ms 256 KB Output is correct
24 Correct 96 ms 352 KB Output is correct
25 Incorrect 3 ms 256 KB Output isn't correct
26 Halted 0 ms 0 KB -