Submission #227410

# Submission time Handle Problem Language Result Execution time Memory
227410 2020-04-27T09:56:03 Z shafinalam Bali Sculptures (APIO15_sculpture) C++14
21 / 100
26 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 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++)
    {
        ret = min(ret, solve(i+1, k+1)|(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 21 ms 31872 KB Output is correct
2 Correct 21 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 21 ms 31872 KB Output is correct
6 Correct 20 ms 31744 KB Output is correct
7 Correct 21 ms 31744 KB Output is correct
8 Correct 20 ms 31744 KB Output is correct
9 Correct 22 ms 31744 KB Output is correct
10 Correct 20 ms 31744 KB Output is correct
11 Correct 20 ms 31744 KB Output is correct
12 Correct 20 ms 31744 KB Output is correct
13 Correct 21 ms 31744 KB Output is correct
14 Correct 21 ms 31744 KB Output is correct
15 Correct 20 ms 31744 KB Output is correct
16 Correct 21 ms 31744 KB Output is correct
17 Correct 20 ms 31744 KB Output is correct
18 Correct 21 ms 31744 KB Output is correct
19 Correct 20 ms 31744 KB Output is correct
20 Correct 21 ms 31744 KB Output is correct
21 Incorrect 20 ms 31744 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 31720 KB Output is correct
2 Correct 21 ms 31872 KB Output is correct
3 Correct 22 ms 31744 KB Output is correct
4 Correct 21 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 20 ms 31744 KB Output is correct
8 Correct 21 ms 31744 KB Output is correct
9 Correct 20 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 21 ms 31744 KB Output is correct
13 Correct 20 ms 31744 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 20 ms 31744 KB Output is correct
18 Correct 21 ms 31872 KB Output is correct
19 Correct 20 ms 31744 KB Output is correct
20 Correct 20 ms 31872 KB Output is correct
21 Incorrect 21 ms 31744 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 31872 KB Output is correct
2 Correct 21 ms 31744 KB Output is correct
3 Correct 21 ms 31744 KB Output is correct
4 Correct 21 ms 31744 KB Output is correct
5 Correct 22 ms 31744 KB Output is correct
6 Correct 21 ms 31744 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 21 ms 31744 KB Output is correct
11 Correct 25 ms 31744 KB Output is correct
12 Correct 20 ms 31864 KB Output is correct
13 Correct 21 ms 31872 KB Output is correct
14 Correct 20 ms 31744 KB Output is correct
15 Correct 21 ms 31744 KB Output is correct
16 Correct 21 ms 31744 KB Output is correct
17 Correct 20 ms 31744 KB Output is correct
18 Correct 20 ms 31744 KB Output is correct
19 Correct 22 ms 31744 KB Output is correct
20 Correct 21 ms 31744 KB Output is correct
21 Correct 24 ms 32000 KB Output is correct
22 Correct 21 ms 31872 KB Output is correct
23 Correct 21 ms 31744 KB Output is correct
24 Correct 21 ms 31744 KB Output is correct
25 Correct 20 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 21 ms 31872 KB Output is correct
29 Correct 21 ms 31872 KB Output is correct
30 Correct 21 ms 31872 KB Output is correct
31 Correct 21 ms 31744 KB Output is correct
32 Correct 21 ms 31744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 31744 KB Output is correct
2 Correct 21 ms 31744 KB Output is correct
3 Correct 21 ms 31744 KB Output is correct
4 Correct 21 ms 31744 KB Output is correct
5 Correct 26 ms 31744 KB Output is correct
6 Correct 22 ms 31872 KB Output is correct
7 Correct 21 ms 31744 KB Output is correct
8 Correct 21 ms 31872 KB Output is correct
9 Correct 20 ms 31744 KB Output is correct
10 Correct 21 ms 31744 KB Output is correct
11 Correct 21 ms 31744 KB Output is correct
12 Correct 25 ms 31872 KB Output is correct
13 Correct 21 ms 31744 KB Output is correct
14 Correct 20 ms 31872 KB Output is correct
15 Correct 21 ms 31744 KB Output is correct
16 Correct 21 ms 31872 KB Output is correct
17 Correct 20 ms 31744 KB Output is correct
18 Correct 21 ms 31872 KB Output is correct
19 Correct 20 ms 31744 KB Output is correct
20 Correct 20 ms 31744 KB Output is correct
21 Incorrect 21 ms 31872 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 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 21 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 21 ms 31744 KB Output is correct
8 Correct 21 ms 31872 KB Output is correct
9 Correct 21 ms 31872 KB Output is correct
10 Correct 21 ms 31872 KB Output is correct
11 Correct 20 ms 31744 KB Output is correct
12 Correct 21 ms 31744 KB Output is correct
13 Correct 21 ms 31872 KB Output is correct
14 Correct 23 ms 31744 KB Output is correct
15 Correct 21 ms 31744 KB Output is correct
16 Correct 21 ms 31872 KB Output is correct
17 Correct 21 ms 31872 KB Output is correct
18 Incorrect 22 ms 31744 KB Output isn't correct
19 Halted 0 ms 0 KB -