Submission #227425

# Submission time Handle Problem Language Result Execution time Memory
227425 2020-04-27T11:49:14 Z shafinalam Bali Sculptures (APIO15_sculpture) C++14
21 / 100
27 ms 32000 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 inf = 0;
ll solve(int pos, int k)
{
    if(pos>n)
    {
        if(k>=A && k<=B) return 0;
        return inf;
    }
    if(dp[pos][k]!=-1) return dp[pos][k];
    ll ret = inf;
    //cout << ret << '\n';
    for(int i = pos; i <= n; i++)
    {
        ll tmp = solve(i+1, k+1);
        if(tmp==inf) ret = tmp;
        else ret = min(ret, tmp|(pre[i]-pre[pos-1]));
    }
    //cout << ret << '\n';
    return dp[pos][k] = ret;
}
int main()
{
    //cout << inf << '\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];
    inf = pre[n]+10;
    memset(dp, -1, sizeof dp);
    ll ans = solve(1, 0);
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 21 ms 31736 KB Output is correct
2 Correct 20 ms 31744 KB Output is correct
3 Correct 21 ms 31744 KB Output is correct
4 Correct 24 ms 31744 KB Output is correct
5 Correct 20 ms 31744 KB Output is correct
6 Correct 19 ms 31744 KB Output is correct
7 Correct 19 ms 31744 KB Output is correct
8 Correct 22 ms 31744 KB Output is correct
9 Correct 22 ms 31744 KB Output is correct
10 Correct 20 ms 31872 KB Output is correct
11 Correct 20 ms 31744 KB Output is correct
12 Correct 20 ms 31872 KB Output is correct
13 Correct 20 ms 31744 KB Output is correct
14 Incorrect 20 ms 31744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 31872 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 20 ms 31744 KB Output is correct
6 Correct 20 ms 31744 KB Output is correct
7 Correct 20 ms 31744 KB Output is correct
8 Correct 21 ms 31872 KB Output is correct
9 Correct 21 ms 31744 KB Output is correct
10 Correct 20 ms 31744 KB Output is correct
11 Correct 20 ms 31872 KB Output is correct
12 Correct 23 ms 31744 KB Output is correct
13 Correct 20 ms 31744 KB Output is correct
14 Incorrect 21 ms 31744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 31744 KB Output is correct
2 Correct 20 ms 31744 KB Output is correct
3 Correct 21 ms 31744 KB Output is correct
4 Correct 20 ms 31744 KB Output is correct
5 Correct 23 ms 31744 KB Output is correct
6 Correct 21 ms 31744 KB Output is correct
7 Correct 20 ms 31744 KB Output is correct
8 Correct 20 ms 31744 KB Output is correct
9 Correct 20 ms 31744 KB Output is correct
10 Correct 27 ms 31788 KB Output is correct
11 Correct 20 ms 31744 KB Output is correct
12 Correct 20 ms 31744 KB Output is correct
13 Correct 19 ms 31744 KB Output is correct
14 Correct 20 ms 31872 KB Output is correct
15 Correct 20 ms 31744 KB Output is correct
16 Correct 20 ms 31736 KB Output is correct
17 Correct 21 ms 31744 KB Output is correct
18 Correct 24 ms 31744 KB Output is correct
19 Correct 20 ms 31744 KB Output is correct
20 Correct 24 ms 31744 KB Output is correct
21 Correct 20 ms 31872 KB Output is correct
22 Correct 20 ms 31872 KB Output is correct
23 Correct 23 ms 31744 KB Output is correct
24 Correct 20 ms 31744 KB Output is correct
25 Correct 21 ms 31744 KB Output is correct
26 Correct 21 ms 31744 KB Output is correct
27 Correct 21 ms 31744 KB Output is correct
28 Correct 24 ms 31744 KB Output is correct
29 Correct 21 ms 31804 KB Output is correct
30 Correct 25 ms 31736 KB Output is correct
31 Correct 23 ms 31744 KB Output is correct
32 Correct 22 ms 31848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 31744 KB Output is correct
2 Correct 19 ms 31872 KB Output is correct
3 Correct 24 ms 31744 KB Output is correct
4 Correct 25 ms 31872 KB Output is correct
5 Correct 20 ms 31744 KB Output is correct
6 Correct 20 ms 31872 KB Output is correct
7 Correct 21 ms 31744 KB Output is correct
8 Correct 20 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 20 ms 31872 KB Output is correct
12 Correct 20 ms 31744 KB Output is correct
13 Correct 20 ms 31744 KB Output is correct
14 Incorrect 20 ms 31744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 32000 KB Output is correct
2 Correct 19 ms 31744 KB Output is correct
3 Correct 20 ms 31744 KB Output is correct
4 Correct 25 ms 31744 KB Output is correct
5 Correct 24 ms 31744 KB Output is correct
6 Correct 20 ms 31744 KB Output is correct
7 Correct 20 ms 31744 KB Output is correct
8 Correct 24 ms 32000 KB Output is correct
9 Correct 20 ms 31744 KB Output is correct
10 Correct 20 ms 31744 KB Output is correct
11 Correct 20 ms 31748 KB Output is correct
12 Correct 20 ms 31872 KB Output is correct
13 Correct 24 ms 31744 KB Output is correct
14 Correct 20 ms 31744 KB Output is correct
15 Correct 20 ms 31744 KB Output is correct
16 Correct 20 ms 31872 KB Output is correct
17 Correct 21 ms 31744 KB Output is correct
18 Incorrect 20 ms 31744 KB Output isn't correct
19 Halted 0 ms 0 KB -