Submission #110276

# Submission time Handle Problem Language Result Execution time Memory
110276 2019-05-10T12:49:11 Z _demon_ Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
long long n,a,b;
long long arr[29];
vector<int>vv;
long long bt(int id,vector<int>v){
    if(id==n-1){
        if(v.size()+1>b || v.size()+1<a) return 1000000000009ll;
        bool done[29]={0};
        for(int i=0;i<v.size();i++){
            done[v[i]]=1;
        }
        long long all=0;
        long long sum=0;
        for(int i=0;i<n;i++){
            sum+=arr[i];
            if(done[i]){
                all|=sum;
                sum=0;
            }
        }
        all|=sum;
        /*if(all==11){
            for(int i=0;i<v.size();i++){
                cout<<v[i]<<" ";
            }
            cout<<endl;
        }*/
        return all;
    }
    long long ans=1000000000009ll;
    ans=min(ans,bt(id+1,v));
    v.push_back(id);
    ans=min(ans,bt(id+1,v));
    return ans;
}
int main(){
 cin>>n>>a>>b;
    for(int i=0;i<n;i++)cin>>arr[i];
    cout<<bt(0,vv)<<endl;
}

Compilation message

sculpture.cpp: In function 'long long int bt(int, std::vector<int>)':
sculpture.cpp:8:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v.size()+1>b || v.size()+1<a) return 1000000000009ll;
            ~~~~~~~~~~^~
sculpture.cpp:8:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v.size()+1>b || v.size()+1<a) return 1000000000009ll;
                            ~~~~~~~~~~^~
sculpture.cpp:10:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v.size();i++){
                     ~^~~~~~~~~
# 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 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 6 ms 384 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
8 Correct 61 ms 320 KB Output is correct
9 Correct 65 ms 256 KB Output is correct
10 Correct 61 ms 384 KB Output is correct
11 Correct 68 ms 428 KB Output is correct
12 Correct 82 ms 384 KB Output is correct
13 Correct 95 ms 364 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 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 11 ms 400 KB Output is correct
21 Correct 63 ms 256 KB Output is correct
22 Correct 64 ms 428 KB Output is correct
23 Correct 64 ms 364 KB Output is correct
24 Correct 61 ms 396 KB Output is correct
25 Correct 64 ms 504 KB Output is correct
26 Correct 91 ms 376 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 34 ms 384 KB Output is correct
31 Correct 78 ms 504 KB Output is correct
32 Correct 79 ms 384 KB Output is correct
33 Correct 88 ms 256 KB Output is correct
34 Correct 94 ms 384 KB Output is correct
35 Correct 66 ms 384 KB Output is correct
36 Correct 109 ms 256 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 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
8 Correct 63 ms 384 KB Output is correct
9 Correct 78 ms 360 KB Output is correct
10 Correct 61 ms 256 KB Output is correct
11 Correct 84 ms 256 KB Output is correct
12 Correct 79 ms 256 KB Output is correct
13 Correct 127 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 256 KB Output is correct
16 Correct 4 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 5 ms 384 KB Output is correct
20 Correct 12 ms 384 KB Output is correct
21 Correct 88 ms 384 KB Output is correct
22 Correct 111 ms 504 KB Output is correct
23 Correct 105 ms 384 KB Output is correct
24 Correct 75 ms 256 KB Output is correct
25 Correct 76 ms 384 KB Output is correct
26 Correct 112 ms 376 KB Output is correct
27 Correct 254 ms 360 KB Output is correct
28 Execution timed out 1073 ms 256 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
8 Correct 66 ms 364 KB Output is correct
9 Correct 68 ms 256 KB Output is correct
10 Correct 79 ms 384 KB Output is correct
11 Correct 76 ms 384 KB Output is correct
12 Correct 70 ms 384 KB Output is correct
13 Correct 110 ms 356 KB Output is correct
14 Correct 195 ms 376 KB Output is correct
15 Execution timed out 1054 ms 256 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 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 16 ms 384 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
8 Correct 77 ms 384 KB Output is correct
9 Correct 82 ms 368 KB Output is correct
10 Correct 62 ms 512 KB Output is correct
11 Correct 71 ms 256 KB Output is correct
12 Correct 72 ms 384 KB Output is correct
13 Correct 131 ms 364 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 2 ms 384 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 6 ms 256 KB Output is correct
20 Correct 14 ms 384 KB Output is correct
21 Correct 80 ms 256 KB Output is correct
22 Correct 81 ms 368 KB Output is correct
23 Correct 80 ms 384 KB Output is correct
24 Correct 84 ms 384 KB Output is correct
25 Correct 79 ms 504 KB Output is correct
26 Correct 133 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 3 ms 384 KB Output is correct
30 Correct 32 ms 384 KB Output is correct
31 Correct 65 ms 376 KB Output is correct
32 Correct 78 ms 384 KB Output is correct
33 Correct 101 ms 384 KB Output is correct
34 Correct 97 ms 384 KB Output is correct
35 Correct 62 ms 360 KB Output is correct
36 Correct 125 ms 384 KB Output is correct
37 Correct 276 ms 396 KB Output is correct
38 Execution timed out 1071 ms 384 KB Time limit exceeded
39 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 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
8 Correct 74 ms 384 KB Output is correct
9 Correct 76 ms 384 KB Output is correct
10 Correct 62 ms 384 KB Output is correct
11 Correct 67 ms 384 KB Output is correct
12 Correct 81 ms 376 KB Output is correct
13 Correct 100 ms 384 KB Output is correct
14 Correct 3 ms 356 KB Output is correct
15 Correct 3 ms 256 KB Output is correct
16 Correct 3 ms 256 KB Output is correct
17 Correct 32 ms 356 KB Output is correct
18 Correct 84 ms 256 KB Output is correct
19 Correct 66 ms 356 KB Output is correct
20 Correct 149 ms 384 KB Output is correct
21 Correct 91 ms 384 KB Output is correct
22 Correct 63 ms 388 KB Output is correct
23 Correct 91 ms 384 KB Output is correct
24 Correct 181 ms 384 KB Output is correct
25 Execution timed out 1082 ms 256 KB Time limit exceeded
26 Halted 0 ms 0 KB -