Submission #111024

# Submission time Handle Problem Language Result Execution time Memory
111024 2019-05-13T14:47:55 Z _demon_ Bali Sculptures (APIO15_sculpture) C++14
21 / 100
20 ms 1152 KB
#include <bits/stdc++.h>
using namespace std;
int n,x,y;
int a[109];
int inf=1000000009;
int dp[109][2100];
void memo(){
    for(int i=0;i<=n;i++){
        for(int j=0;j<=2050;j++){
            dp[i][j]=inf;
        }
    }
    dp[0][0]=0;
}
int main(){
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++) cin>>a[i];
    memo();
    for(int i=1;i<=n;i++){
        int sum=0;
        for(int j=i;j>=1;j--){
            sum+=a[j];
            for(int k=0;k<=2050;k++){
                if(dp[j-1][k]==inf) continue;
                dp[i][sum|k]=min(dp[i][sum|k],dp[j-1][k]+1);
            }
        }
    }
    int ans=inf;
    for(int i=0;i<=2050;i++){
        if(dp[n][i]<=y){
            cout<<i<<endl;
            exit(0);
        }
    }
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:29:9: warning: unused variable 'ans' [-Wunused-variable]
     int ans=inf;
         ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 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 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 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 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 4 ms 512 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 3 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 5 ms 640 KB Output is correct
17 Correct 5 ms 640 KB Output is correct
18 Correct 6 ms 768 KB Output is correct
19 Correct 6 ms 768 KB Output is correct
20 Correct 5 ms 768 KB Output is correct
21 Correct 5 ms 768 KB Output is correct
22 Correct 6 ms 796 KB Output is correct
23 Correct 4 ms 768 KB Output is correct
24 Correct 5 ms 768 KB Output is correct
25 Correct 7 ms 896 KB Output is correct
26 Correct 8 ms 896 KB Output is correct
27 Correct 11 ms 1024 KB Output is correct
28 Correct 13 ms 1152 KB Output is correct
29 Correct 18 ms 1152 KB Output is correct
30 Correct 20 ms 1152 KB Output is correct
31 Correct 15 ms 1152 KB Output is correct
32 Correct 14 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 4 ms 512 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 3 ms 384 KB Output isn't correct
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 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -