답안 #405819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405819 2021-05-16T23:23:09 Z A_D Bali Sculptures (APIO15_sculpture) C++14
0 / 100
35 ms 57312 KB
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
using namespace std;
const int N=1e3+100;
set<int> st[N][N];
int a[N];
main()
{
    int n,A,B;
    cin>>n>>A>>B;
    st[0][1].insert(0);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(auto x:st[i-1][j]){
                st[i][j].insert(x+a[i]);
            }
            int v=a[i];
            for(int k=i-1;k>=1;k--){
                for(auto x:st[k][j-1]){
                    st[i][j].insert(x|v);
                }
                v+=a[k];
            }
        }
    }
    int ans=1e18;
    for(int i=A;i<=B;i++){
        for(auto x:st[n][i])ans=min(ans,x);
    }
    cout<<ans<<endl;
}
/*
6 1 3
8 1 2 1 5 4
*/

Compilation message

sculpture.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~
sculpture.cpp: In function 'int main()':
sculpture.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 57036 KB Output is correct
2 Correct 30 ms 57064 KB Output is correct
3 Correct 33 ms 57120 KB Output is correct
4 Correct 30 ms 57112 KB Output is correct
5 Correct 31 ms 57080 KB Output is correct
6 Correct 30 ms 57164 KB Output is correct
7 Incorrect 31 ms 57284 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 57004 KB Output is correct
2 Correct 30 ms 57068 KB Output is correct
3 Correct 29 ms 57084 KB Output is correct
4 Correct 31 ms 57036 KB Output is correct
5 Correct 34 ms 57048 KB Output is correct
6 Correct 30 ms 57164 KB Output is correct
7 Incorrect 33 ms 57312 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 57140 KB Output is correct
2 Correct 30 ms 57004 KB Output is correct
3 Correct 30 ms 57064 KB Output is correct
4 Correct 30 ms 57036 KB Output is correct
5 Correct 30 ms 57076 KB Output is correct
6 Correct 31 ms 57172 KB Output is correct
7 Incorrect 31 ms 57192 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 57036 KB Output is correct
2 Correct 29 ms 57128 KB Output is correct
3 Correct 30 ms 57108 KB Output is correct
4 Correct 35 ms 57028 KB Output is correct
5 Correct 30 ms 57128 KB Output is correct
6 Correct 31 ms 57172 KB Output is correct
7 Incorrect 31 ms 57284 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 57112 KB Output is correct
2 Correct 33 ms 57108 KB Output is correct
3 Correct 31 ms 57004 KB Output is correct
4 Correct 31 ms 57000 KB Output is correct
5 Correct 30 ms 57028 KB Output is correct
6 Correct 30 ms 57164 KB Output is correct
7 Incorrect 31 ms 57204 KB Output isn't correct
8 Halted 0 ms 0 KB -