답안 #405840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405840 2021-05-16T23:41:38 Z A_D Bali Sculptures (APIO15_sculpture) C++14
46 / 100
1000 ms 111828 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;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    int pre=0;
    for(int i=1;i<=n;i++){
        pre+=a[i];
        st[i][1].insert(pre);
    }
    for(int i=1;i<=n;i++){
        for(int j=2;j<=n;j++){
            int v=a[i];
            for(int k=i-1;k>=1;k--){
                for(auto x:st[k][j-1]){
                    if(i==3&&j==2){
//                        cout<<x<<" "<<v<<endl;
                    }
                    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;
    /*
    cout<<"\n\n";
        for(int j=1;j<=n;j++){
    for(int i=1;i<=n;i++){
            for(auto x:st[i][j])cout<<x<<" ";
            cout<<endl;
        }
        cout<<endl;
    }
    */
}
/*
6 1 3
8 1 2 1 5 4

4 1 4
2 3 1 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:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 57100 KB Output is correct
2 Correct 31 ms 57068 KB Output is correct
3 Correct 36 ms 57048 KB Output is correct
4 Correct 32 ms 57072 KB Output is correct
5 Correct 30 ms 57024 KB Output is correct
6 Correct 30 ms 57136 KB Output is correct
7 Correct 30 ms 57148 KB Output is correct
8 Correct 33 ms 57152 KB Output is correct
9 Correct 31 ms 57116 KB Output is correct
10 Correct 32 ms 57040 KB Output is correct
11 Correct 34 ms 57128 KB Output is correct
12 Correct 35 ms 57128 KB Output is correct
13 Correct 31 ms 57048 KB Output is correct
14 Correct 32 ms 57100 KB Output is correct
15 Correct 35 ms 57100 KB Output is correct
16 Correct 31 ms 57028 KB Output is correct
17 Correct 30 ms 57096 KB Output is correct
18 Correct 35 ms 57072 KB Output is correct
19 Correct 31 ms 57116 KB Output is correct
20 Correct 32 ms 57108 KB Output is correct
21 Correct 33 ms 57120 KB Output is correct
22 Correct 30 ms 57100 KB Output is correct
23 Correct 35 ms 57132 KB Output is correct
24 Correct 32 ms 57132 KB Output is correct
25 Correct 31 ms 57168 KB Output is correct
26 Correct 31 ms 57128 KB Output is correct
27 Correct 32 ms 57108 KB Output is correct
28 Correct 34 ms 57100 KB Output is correct
29 Correct 31 ms 57140 KB Output is correct
30 Correct 32 ms 57548 KB Output is correct
31 Correct 30 ms 57164 KB Output is correct
32 Correct 34 ms 57208 KB Output is correct
33 Correct 36 ms 57108 KB Output is correct
34 Correct 34 ms 57116 KB Output is correct
35 Correct 32 ms 57036 KB Output is correct
36 Correct 33 ms 57036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 57004 KB Output is correct
2 Correct 31 ms 57072 KB Output is correct
3 Correct 30 ms 57056 KB Output is correct
4 Correct 31 ms 57036 KB Output is correct
5 Correct 34 ms 57036 KB Output is correct
6 Correct 35 ms 57088 KB Output is correct
7 Correct 30 ms 57020 KB Output is correct
8 Correct 31 ms 57108 KB Output is correct
9 Correct 30 ms 57144 KB Output is correct
10 Correct 33 ms 57052 KB Output is correct
11 Correct 34 ms 57072 KB Output is correct
12 Correct 37 ms 57128 KB Output is correct
13 Correct 35 ms 57192 KB Output is correct
14 Correct 33 ms 57084 KB Output is correct
15 Correct 34 ms 57104 KB Output is correct
16 Correct 32 ms 57036 KB Output is correct
17 Correct 32 ms 57060 KB Output is correct
18 Correct 32 ms 57120 KB Output is correct
19 Correct 32 ms 57156 KB Output is correct
20 Correct 34 ms 57120 KB Output is correct
21 Correct 33 ms 57096 KB Output is correct
22 Correct 33 ms 57172 KB Output is correct
23 Correct 32 ms 57120 KB Output is correct
24 Correct 33 ms 57092 KB Output is correct
25 Correct 33 ms 57164 KB Output is correct
26 Correct 38 ms 57140 KB Output is correct
27 Correct 37 ms 57080 KB Output is correct
28 Correct 33 ms 57212 KB Output is correct
29 Correct 41 ms 57580 KB Output is correct
30 Correct 39 ms 57652 KB Output is correct
31 Correct 51 ms 58472 KB Output is correct
32 Correct 46 ms 57760 KB Output is correct
33 Correct 40 ms 57868 KB Output is correct
34 Correct 44 ms 58008 KB Output is correct
35 Correct 44 ms 58048 KB Output is correct
36 Correct 53 ms 58224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 57020 KB Output is correct
2 Correct 31 ms 57084 KB Output is correct
3 Correct 32 ms 57068 KB Output is correct
4 Correct 32 ms 57000 KB Output is correct
5 Correct 32 ms 57028 KB Output is correct
6 Correct 32 ms 57036 KB Output is correct
7 Correct 32 ms 57060 KB Output is correct
8 Correct 32 ms 57140 KB Output is correct
9 Correct 31 ms 57120 KB Output is correct
10 Correct 32 ms 57156 KB Output is correct
11 Correct 31 ms 57164 KB Output is correct
12 Correct 31 ms 57124 KB Output is correct
13 Correct 31 ms 57128 KB Output is correct
14 Correct 34 ms 57156 KB Output is correct
15 Correct 33 ms 57188 KB Output is correct
16 Correct 36 ms 57548 KB Output is correct
17 Correct 37 ms 57676 KB Output is correct
18 Correct 53 ms 58448 KB Output is correct
19 Correct 40 ms 57796 KB Output is correct
20 Correct 40 ms 57820 KB Output is correct
21 Correct 43 ms 58048 KB Output is correct
22 Correct 43 ms 57988 KB Output is correct
23 Correct 48 ms 58188 KB Output is correct
24 Correct 54 ms 58544 KB Output is correct
25 Correct 90 ms 60356 KB Output is correct
26 Correct 161 ms 62936 KB Output is correct
27 Correct 234 ms 65360 KB Output is correct
28 Correct 343 ms 68008 KB Output is correct
29 Correct 212 ms 64440 KB Output is correct
30 Correct 212 ms 64460 KB Output is correct
31 Correct 367 ms 69716 KB Output is correct
32 Correct 398 ms 69872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 57036 KB Output is correct
2 Correct 33 ms 57128 KB Output is correct
3 Correct 32 ms 57076 KB Output is correct
4 Correct 33 ms 57124 KB Output is correct
5 Correct 37 ms 57060 KB Output is correct
6 Correct 32 ms 57048 KB Output is correct
7 Correct 32 ms 57048 KB Output is correct
8 Correct 33 ms 57112 KB Output is correct
9 Correct 32 ms 57120 KB Output is correct
10 Correct 35 ms 57092 KB Output is correct
11 Correct 31 ms 57072 KB Output is correct
12 Correct 33 ms 57068 KB Output is correct
13 Correct 32 ms 57156 KB Output is correct
14 Correct 31 ms 57036 KB Output is correct
15 Correct 32 ms 57116 KB Output is correct
16 Correct 31 ms 57104 KB Output is correct
17 Correct 33 ms 57012 KB Output is correct
18 Correct 33 ms 57124 KB Output is correct
19 Correct 32 ms 57076 KB Output is correct
20 Correct 33 ms 57028 KB Output is correct
21 Correct 33 ms 57164 KB Output is correct
22 Correct 35 ms 57096 KB Output is correct
23 Correct 36 ms 57060 KB Output is correct
24 Correct 33 ms 57164 KB Output is correct
25 Correct 33 ms 57076 KB Output is correct
26 Correct 32 ms 57052 KB Output is correct
27 Correct 32 ms 57032 KB Output is correct
28 Correct 32 ms 57084 KB Output is correct
29 Correct 33 ms 57068 KB Output is correct
30 Correct 36 ms 57516 KB Output is correct
31 Correct 33 ms 57152 KB Output is correct
32 Correct 33 ms 57124 KB Output is correct
33 Correct 37 ms 57156 KB Output is correct
34 Correct 32 ms 57076 KB Output is correct
35 Correct 33 ms 57044 KB Output is correct
36 Correct 32 ms 57112 KB Output is correct
37 Correct 32 ms 57104 KB Output is correct
38 Correct 33 ms 57172 KB Output is correct
39 Correct 38 ms 57560 KB Output is correct
40 Correct 40 ms 57732 KB Output is correct
41 Correct 51 ms 58512 KB Output is correct
42 Correct 40 ms 57796 KB Output is correct
43 Correct 40 ms 57780 KB Output is correct
44 Correct 43 ms 58080 KB Output is correct
45 Correct 44 ms 58036 KB Output is correct
46 Correct 46 ms 58180 KB Output is correct
47 Correct 53 ms 58608 KB Output is correct
48 Correct 108 ms 60440 KB Output is correct
49 Correct 165 ms 62924 KB Output is correct
50 Correct 244 ms 65280 KB Output is correct
51 Correct 372 ms 67992 KB Output is correct
52 Correct 201 ms 64328 KB Output is correct
53 Correct 202 ms 64300 KB Output is correct
54 Correct 387 ms 69732 KB Output is correct
55 Correct 411 ms 69824 KB Output is correct
56 Correct 637 ms 92556 KB Output is correct
57 Execution timed out 1087 ms 111828 KB Time limit exceeded
58 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 57036 KB Output is correct
2 Correct 31 ms 57036 KB Output is correct
3 Correct 31 ms 57028 KB Output is correct
4 Correct 32 ms 57088 KB Output is correct
5 Correct 35 ms 57232 KB Output is correct
6 Correct 33 ms 57008 KB Output is correct
7 Correct 32 ms 57164 KB Output is correct
8 Correct 32 ms 57076 KB Output is correct
9 Correct 32 ms 57100 KB Output is correct
10 Correct 32 ms 57076 KB Output is correct
11 Correct 33 ms 57080 KB Output is correct
12 Correct 34 ms 57064 KB Output is correct
13 Correct 36 ms 57164 KB Output is correct
14 Correct 33 ms 57236 KB Output is correct
15 Correct 33 ms 57148 KB Output is correct
16 Correct 33 ms 57172 KB Output is correct
17 Correct 35 ms 57492 KB Output is correct
18 Correct 33 ms 57164 KB Output is correct
19 Correct 34 ms 57156 KB Output is correct
20 Correct 31 ms 57164 KB Output is correct
21 Correct 32 ms 57036 KB Output is correct
22 Correct 31 ms 57068 KB Output is correct
23 Correct 32 ms 57064 KB Output is correct
24 Correct 32 ms 57156 KB Output is correct
25 Correct 38 ms 57252 KB Output is correct
26 Correct 37 ms 57532 KB Output is correct
27 Correct 39 ms 57700 KB Output is correct
28 Correct 52 ms 58548 KB Output is correct
29 Correct 41 ms 57792 KB Output is correct
30 Correct 41 ms 57768 KB Output is correct
31 Correct 44 ms 58036 KB Output is correct
32 Correct 46 ms 57952 KB Output is correct
33 Correct 47 ms 58112 KB Output is correct
34 Correct 53 ms 58628 KB Output is correct
35 Correct 99 ms 60372 KB Output is correct
36 Correct 177 ms 62916 KB Output is correct
37 Correct 252 ms 65316 KB Output is correct
38 Correct 338 ms 67904 KB Output is correct
39 Correct 217 ms 64452 KB Output is correct
40 Correct 203 ms 64324 KB Output is correct
41 Correct 368 ms 69700 KB Output is correct
42 Correct 384 ms 69816 KB Output is correct
43 Correct 634 ms 92504 KB Output is correct
44 Execution timed out 1080 ms 109396 KB Time limit exceeded
45 Halted 0 ms 0 KB -