Submission #620569

# Submission time Handle Problem Language Result Execution time Memory
620569 2022-08-03T07:14:08 Z daisy2 Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 456 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];
    }

    cout<<fin(n,0,0)<<endl;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 5 ms 456 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 4 ms 212 KB Output is correct
11 Correct 5 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 4 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 5 ms 212 KB Output is correct
22 Correct 5 ms 336 KB Output is correct
23 Correct 5 ms 332 KB Output is correct
24 Correct 5 ms 212 KB Output is correct
25 Correct 5 ms 332 KB Output is correct
26 Correct 5 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Correct 4 ms 212 KB Output is correct
32 Correct 4 ms 212 KB Output is correct
33 Correct 5 ms 328 KB Output is correct
34 Correct 5 ms 212 KB Output is correct
35 Correct 5 ms 328 KB Output is correct
36 Correct 4 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 4 ms 340 KB Output is correct
9 Correct 5 ms 320 KB Output is correct
10 Correct 4 ms 212 KB Output is correct
11 Correct 5 ms 212 KB Output is correct
12 Correct 5 ms 324 KB Output is correct
13 Correct 5 ms 328 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 328 KB Output is correct
21 Correct 5 ms 212 KB Output is correct
22 Correct 5 ms 212 KB Output is correct
23 Correct 5 ms 244 KB Output is correct
24 Correct 5 ms 212 KB Output is correct
25 Correct 6 ms 212 KB Output is correct
26 Correct 5 ms 328 KB Output is correct
27 Correct 9 ms 212 KB Output is correct
28 Correct 136 ms 324 KB Output is correct
29 Execution timed out 1065 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 328 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 328 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 4 ms 328 KB Output is correct
9 Correct 4 ms 212 KB Output is correct
10 Correct 5 ms 328 KB Output is correct
11 Correct 5 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 9 ms 224 KB Output is correct
15 Correct 129 ms 328 KB Output is correct
16 Execution timed out 1093 ms 212 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 4 ms 328 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 6 ms 328 KB Output is correct
11 Correct 5 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 4 ms 212 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 6 ms 340 KB Output is correct
22 Correct 5 ms 212 KB Output is correct
23 Correct 5 ms 336 KB Output is correct
24 Correct 5 ms 212 KB Output is correct
25 Correct 5 ms 328 KB Output is correct
26 Correct 4 ms 328 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 4 ms 212 KB Output is correct
31 Correct 6 ms 212 KB Output is correct
32 Correct 5 ms 212 KB Output is correct
33 Correct 5 ms 212 KB Output is correct
34 Correct 5 ms 212 KB Output is correct
35 Correct 4 ms 212 KB Output is correct
36 Correct 5 ms 212 KB Output is correct
37 Correct 11 ms 340 KB Output is correct
38 Correct 133 ms 320 KB Output is correct
39 Execution timed out 1095 ms 212 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 5 ms 332 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 5 ms 328 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 6 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 5 ms 212 KB Output is correct
19 Correct 5 ms 332 KB Output is correct
20 Correct 5 ms 212 KB Output is correct
21 Correct 5 ms 212 KB Output is correct
22 Correct 5 ms 328 KB Output is correct
23 Correct 5 ms 340 KB Output is correct
24 Correct 10 ms 332 KB Output is correct
25 Correct 155 ms 340 KB Output is correct
26 Execution timed out 1096 ms 212 KB Time limit exceeded
27 Halted 0 ms 0 KB -