Submission #227412

# Submission time Handle Problem Language Result Execution time Memory
227412 2020-04-27T09:58:34 Z shafinalam Bali Sculptures (APIO15_sculpture) C++14
21 / 100
22 ms 31872 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int mxn = 2005;

ll n, A, B;
ll arr[mxn];
ll pre[mxn];
ll dp[mxn][mxn];
ll last = pow(2,50);
ll solve(int pos, int k)
{
    if(pos>n)
    {
        if(k>=A && k<=B) return 0;
        return last;
    }
    if(dp[pos][k]!=-1) return dp[pos][k];
    ll ret = last;
    //cout << ret << '\n';
    for(int i = pos; i <= n; i++)
    {
        ll tmp = solve(i+1, k+1);
        if(tmp==last) ret = tmp;
        else ret = min(ret, tmp|(pre[i]-pre[pos-1]));
    }
    //cout << ret << '\n';
    return dp[pos][k] = ret;
}
int main()
{
    //cout << last << '\n';
    cin >> n >> A >> B;


    for(int i = 1; i <= n; i++) cin >> arr[i];
    for(int i = 1; i <= n; i++) pre[i] = pre[i-1]+arr[i];
    memset(dp, -1, sizeof dp);
    ll ans = solve(1, 0);
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 20 ms 31744 KB Output is correct
2 Correct 19 ms 31744 KB Output is correct
3 Correct 19 ms 31744 KB Output is correct
4 Correct 19 ms 31744 KB Output is correct
5 Correct 19 ms 31872 KB Output is correct
6 Correct 19 ms 31744 KB Output is correct
7 Correct 20 ms 31744 KB Output is correct
8 Correct 19 ms 31744 KB Output is correct
9 Correct 19 ms 31744 KB Output is correct
10 Correct 20 ms 31744 KB Output is correct
11 Correct 19 ms 31744 KB Output is correct
12 Correct 19 ms 31872 KB Output is correct
13 Correct 19 ms 31872 KB Output is correct
14 Incorrect 19 ms 31872 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 31744 KB Output is correct
2 Correct 20 ms 31744 KB Output is correct
3 Correct 20 ms 31804 KB Output is correct
4 Correct 20 ms 31744 KB Output is correct
5 Correct 21 ms 31744 KB Output is correct
6 Correct 20 ms 31744 KB Output is correct
7 Correct 20 ms 31872 KB Output is correct
8 Correct 19 ms 31872 KB Output is correct
9 Correct 20 ms 31744 KB Output is correct
10 Correct 20 ms 31872 KB Output is correct
11 Correct 19 ms 31872 KB Output is correct
12 Correct 19 ms 31872 KB Output is correct
13 Correct 19 ms 31872 KB Output is correct
14 Incorrect 19 ms 31744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 31872 KB Output is correct
2 Correct 19 ms 31872 KB Output is correct
3 Correct 19 ms 31744 KB Output is correct
4 Correct 19 ms 31744 KB Output is correct
5 Correct 19 ms 31872 KB Output is correct
6 Correct 20 ms 31744 KB Output is correct
7 Correct 19 ms 31732 KB Output is correct
8 Correct 19 ms 31744 KB Output is correct
9 Correct 20 ms 31872 KB Output is correct
10 Correct 19 ms 31872 KB Output is correct
11 Correct 21 ms 31744 KB Output is correct
12 Correct 20 ms 31744 KB Output is correct
13 Correct 19 ms 31872 KB Output is correct
14 Correct 19 ms 31744 KB Output is correct
15 Correct 19 ms 31872 KB Output is correct
16 Correct 19 ms 31744 KB Output is correct
17 Correct 20 ms 31872 KB Output is correct
18 Correct 19 ms 31744 KB Output is correct
19 Correct 20 ms 31872 KB Output is correct
20 Correct 19 ms 31872 KB Output is correct
21 Correct 19 ms 31744 KB Output is correct
22 Correct 19 ms 31872 KB Output is correct
23 Correct 20 ms 31744 KB Output is correct
24 Correct 20 ms 31872 KB Output is correct
25 Correct 20 ms 31744 KB Output is correct
26 Correct 19 ms 31744 KB Output is correct
27 Correct 20 ms 31744 KB Output is correct
28 Correct 20 ms 31744 KB Output is correct
29 Correct 20 ms 31788 KB Output is correct
30 Correct 20 ms 31744 KB Output is correct
31 Correct 22 ms 31744 KB Output is correct
32 Correct 21 ms 31744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 31744 KB Output is correct
2 Correct 20 ms 31872 KB Output is correct
3 Correct 19 ms 31872 KB Output is correct
4 Correct 19 ms 31744 KB Output is correct
5 Correct 20 ms 31744 KB Output is correct
6 Correct 21 ms 31744 KB Output is correct
7 Correct 19 ms 31744 KB Output is correct
8 Correct 19 ms 31872 KB Output is correct
9 Correct 21 ms 31872 KB Output is correct
10 Correct 19 ms 31744 KB Output is correct
11 Correct 19 ms 31744 KB Output is correct
12 Correct 20 ms 31744 KB Output is correct
13 Correct 20 ms 31744 KB Output is correct
14 Incorrect 19 ms 31744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 31744 KB Output is correct
2 Correct 20 ms 31744 KB Output is correct
3 Correct 20 ms 31744 KB Output is correct
4 Correct 20 ms 31744 KB Output is correct
5 Correct 19 ms 31744 KB Output is correct
6 Correct 21 ms 31744 KB Output is correct
7 Correct 19 ms 31744 KB Output is correct
8 Correct 19 ms 31744 KB Output is correct
9 Correct 20 ms 31744 KB Output is correct
10 Correct 20 ms 31744 KB Output is correct
11 Correct 21 ms 31744 KB Output is correct
12 Correct 21 ms 31872 KB Output is correct
13 Correct 21 ms 31872 KB Output is correct
14 Correct 20 ms 31872 KB Output is correct
15 Correct 21 ms 31744 KB Output is correct
16 Correct 20 ms 31744 KB Output is correct
17 Correct 19 ms 31776 KB Output is correct
18 Incorrect 19 ms 31744 KB Output isn't correct
19 Halted 0 ms 0 KB -