Submission #111069

# Submission time Handle Problem Language Result Execution time Memory
111069 2019-05-13T15:28:04 Z mayhoubsaleh Bali Sculptures (APIO15_sculpture) C++14
21 / 100
19 ms 11200 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;
ll n,l,r;
ll a[111];
ll dp[111][111][111];

ll solve(ll i,ll last,ll k,ll sum){
    //cout<<"call:  "<<i<<' '<<last<<' '<<k<<' '<<sum<<endl;
    if(i==n){
        if(k>=l&&k<=r&&last==n)return 0;
        return -2;
    }
    ll &ans=dp[i][last][k];
    sum+=a[i];
    if(ans!=-1)return ans;
    ll ans1=solve(i+1,last,k,sum),ans2=solve(i+1,i+1,k+1,0);
    if(ans1==-2&&ans2==-2)return ans=-2;
    if(ans1==-2)return ans=ans2|sum;
    if(ans2==-2)return ans=ans1;
    return ans=min(ans1,ans2|sum);
}
 main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>l>>r;
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof dp);
    cout<<solve(0,0,0,0)<<endl;
    return 0;
}

Compilation message

sculpture.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main(){
       ^
# Verdict Execution time Memory Grader output
1 Correct 11 ms 11008 KB Output is correct
2 Correct 10 ms 11008 KB Output is correct
3 Correct 13 ms 11008 KB Output is correct
4 Correct 10 ms 11008 KB Output is correct
5 Correct 10 ms 10980 KB Output is correct
6 Correct 12 ms 11008 KB Output is correct
7 Correct 12 ms 11008 KB Output is correct
8 Correct 12 ms 11008 KB Output is correct
9 Correct 12 ms 11008 KB Output is correct
10 Correct 10 ms 11008 KB Output is correct
11 Correct 10 ms 11016 KB Output is correct
12 Correct 11 ms 11008 KB Output is correct
13 Correct 13 ms 11008 KB Output is correct
14 Correct 11 ms 11008 KB Output is correct
15 Correct 11 ms 11136 KB Output is correct
16 Correct 11 ms 11008 KB Output is correct
17 Correct 12 ms 11008 KB Output is correct
18 Correct 12 ms 11008 KB Output is correct
19 Correct 11 ms 11008 KB Output is correct
20 Correct 12 ms 11008 KB Output is correct
21 Incorrect 12 ms 11008 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 11008 KB Output is correct
2 Correct 12 ms 11008 KB Output is correct
3 Correct 12 ms 11004 KB Output is correct
4 Correct 11 ms 11008 KB Output is correct
5 Correct 12 ms 11032 KB Output is correct
6 Correct 12 ms 10980 KB Output is correct
7 Correct 11 ms 11008 KB Output is correct
8 Correct 11 ms 10980 KB Output is correct
9 Correct 13 ms 10980 KB Output is correct
10 Correct 10 ms 11036 KB Output is correct
11 Correct 11 ms 10980 KB Output is correct
12 Correct 11 ms 10980 KB Output is correct
13 Correct 14 ms 11008 KB Output is correct
14 Correct 12 ms 11008 KB Output is correct
15 Correct 12 ms 11020 KB Output is correct
16 Correct 12 ms 11008 KB Output is correct
17 Correct 11 ms 11008 KB Output is correct
18 Correct 10 ms 11008 KB Output is correct
19 Correct 12 ms 11056 KB Output is correct
20 Correct 11 ms 11076 KB Output is correct
21 Incorrect 12 ms 11008 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 11076 KB Output is correct
2 Correct 11 ms 11008 KB Output is correct
3 Correct 11 ms 11008 KB Output is correct
4 Correct 11 ms 11008 KB Output is correct
5 Correct 13 ms 11008 KB Output is correct
6 Correct 11 ms 11008 KB Output is correct
7 Correct 12 ms 11052 KB Output is correct
8 Correct 13 ms 11008 KB Output is correct
9 Correct 10 ms 11008 KB Output is correct
10 Correct 13 ms 11008 KB Output is correct
11 Correct 13 ms 11060 KB Output is correct
12 Correct 11 ms 11048 KB Output is correct
13 Correct 10 ms 11008 KB Output is correct
14 Correct 10 ms 11080 KB Output is correct
15 Correct 10 ms 11096 KB Output is correct
16 Correct 10 ms 11008 KB Output is correct
17 Correct 11 ms 11008 KB Output is correct
18 Correct 12 ms 11008 KB Output is correct
19 Correct 11 ms 11200 KB Output is correct
20 Correct 12 ms 11008 KB Output is correct
21 Correct 12 ms 10980 KB Output is correct
22 Correct 12 ms 11008 KB Output is correct
23 Correct 12 ms 11008 KB Output is correct
24 Correct 11 ms 11092 KB Output is correct
25 Correct 13 ms 11008 KB Output is correct
26 Correct 12 ms 10980 KB Output is correct
27 Correct 14 ms 10980 KB Output is correct
28 Correct 17 ms 11008 KB Output is correct
29 Correct 19 ms 11104 KB Output is correct
30 Correct 17 ms 10980 KB Output is correct
31 Correct 14 ms 11008 KB Output is correct
32 Correct 13 ms 10980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 11008 KB Output is correct
2 Correct 11 ms 11008 KB Output is correct
3 Correct 11 ms 11008 KB Output is correct
4 Correct 13 ms 11008 KB Output is correct
5 Correct 11 ms 11008 KB Output is correct
6 Correct 11 ms 11008 KB Output is correct
7 Correct 13 ms 11108 KB Output is correct
8 Correct 13 ms 11056 KB Output is correct
9 Correct 11 ms 11008 KB Output is correct
10 Correct 12 ms 10980 KB Output is correct
11 Correct 11 ms 11008 KB Output is correct
12 Correct 11 ms 11008 KB Output is correct
13 Correct 13 ms 11008 KB Output is correct
14 Correct 11 ms 11008 KB Output is correct
15 Correct 12 ms 11072 KB Output is correct
16 Correct 12 ms 11008 KB Output is correct
17 Correct 11 ms 11008 KB Output is correct
18 Correct 12 ms 10980 KB Output is correct
19 Correct 12 ms 11008 KB Output is correct
20 Correct 11 ms 11008 KB Output is correct
21 Incorrect 16 ms 10976 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 11008 KB Output is correct
2 Correct 10 ms 11008 KB Output is correct
3 Correct 11 ms 11008 KB Output is correct
4 Correct 13 ms 11008 KB Output is correct
5 Correct 13 ms 11008 KB Output is correct
6 Correct 12 ms 11008 KB Output is correct
7 Correct 10 ms 11032 KB Output is correct
8 Correct 13 ms 11008 KB Output is correct
9 Correct 12 ms 11008 KB Output is correct
10 Correct 13 ms 11008 KB Output is correct
11 Correct 12 ms 11008 KB Output is correct
12 Correct 12 ms 11008 KB Output is correct
13 Correct 12 ms 11008 KB Output is correct
14 Correct 11 ms 11008 KB Output is correct
15 Correct 11 ms 11008 KB Output is correct
16 Correct 11 ms 11008 KB Output is correct
17 Correct 10 ms 11008 KB Output is correct
18 Incorrect 10 ms 11008 KB Output isn't correct
19 Halted 0 ms 0 KB -