답안 #110272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110272 2019-05-10T12:42:55 Z _demon_ Bali Sculptures (APIO15_sculpture) C++14
0 / 100
4 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){
        if(v.size()+1>b || v.size()+1<a) return 10000000009ll;
        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=10000000009ll;
    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 10000000009ll;
            ~~~~~~~~~~^~
sculpture.cpp:8:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v.size()+1>b || v.size()+1<a) return 10000000009ll;
                            ~~~~~~~~~~^~
sculpture.cpp:10:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v.size();i++){
                     ~^~~~~~~~~
sculpture.cpp:24:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i=0;i<v.size();i++){
                         ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -