Submission #111020

# Submission time Handle Problem Language Result Execution time Memory
111020 2019-05-13T14:45:00 Z _demon_ Bali Sculptures (APIO15_sculpture) C++14
Compilation error
0 ms 0 KB
using namespace std;
int n,x,y;
int a[109];
int inf=1000000009;
int dp[109][2100];
void memo(){
    for(int i=1;i<=n;i++){
        for(int j=0;j<=2100;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=1;i<=2050;i++){
        if(dp[n][i]!=inf && dp[n][i]<=y){
            cout<<i<<endl;
            exit(0);
        }
    }
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:15:5: error: 'cin' was not declared in this scope
     cin>>n>>x>>y;
     ^~~
sculpture.cpp:15:5: note: suggested alternative: 'main'
     cin>>n>>x>>y;
     ^~~
     main
sculpture.cpp:24:30: error: 'min' was not declared in this scope
                 dp[i][sum|k]=min(dp[i][sum|k],dp[j-1][k]+1);
                              ^~~
sculpture.cpp:24:30: note: suggested alternative: 'main'
                 dp[i][sum|k]=min(dp[i][sum|k],dp[j-1][k]+1);
                              ^~~
                              main
sculpture.cpp:31:13: error: 'cout' was not declared in this scope
             cout<<i<<endl;
             ^~~~
sculpture.cpp:31:22: error: 'endl' was not declared in this scope
             cout<<i<<endl;
                      ^~~~
sculpture.cpp:31:22: note: suggested alternative: 'enum'
             cout<<i<<endl;
                      ^~~~
                      enum
sculpture.cpp:32:13: error: 'exit' was not declared in this scope
             exit(0);
             ^~~~
sculpture.cpp:28:9: warning: unused variable 'ans' [-Wunused-variable]
     int ans=inf;
         ^~~