# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31129 | 2017-08-10T22:34:42 Z | nibnalin | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 17728 KB |
#include <iostream> #include <cstdio> #include <vector> using namespace std; const int maxn = int(2e3)+5, inf = int(1e9)+5; int n, A[maxn], memo[maxn][maxn]; int DP(int idx, int p) { if(idx == n+1 && !p) return 0; else if(p < 0) return inf; else if(memo[idx][p] != -1) return memo[idx][p]; else { int res = inf; for(int i = idx;i <= n;i++) { res = min(res, DP(i+1, p-1)|(A[i]-A[idx-1])); } //cout << idx << " " << p << " " << res << "\n"; return memo[idx][p] = res; } } int main(void) { int a, b; scanf("%d%d%d", &n, &a, &b); for(int i = 0;i <= n;i++) { for(int j = 0;j <= n;j++) memo[i][j] = -1; } for(int i = 1;i <= n;i++) scanf("%d", &A[i]); for(int i = 1;i <= n;i++) A[i] += A[i-1]; printf("%d\n", DP(1, b)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17728 KB | Output is correct |
2 | Correct | 0 ms | 17728 KB | Output is correct |
3 | Correct | 0 ms | 17728 KB | Output is correct |
4 | Correct | 0 ms | 17728 KB | Output is correct |
5 | Correct | 0 ms | 17728 KB | Output is correct |
6 | Correct | 0 ms | 17728 KB | Output is correct |
7 | Correct | 0 ms | 17728 KB | Output is correct |
8 | Correct | 0 ms | 17728 KB | Output is correct |
9 | Correct | 0 ms | 17728 KB | Output is correct |
10 | Correct | 0 ms | 17728 KB | Output is correct |
11 | Correct | 0 ms | 17728 KB | Output is correct |
12 | Correct | 0 ms | 17728 KB | Output is correct |
13 | Correct | 0 ms | 17728 KB | Output is correct |
14 | Correct | 0 ms | 17728 KB | Output is correct |
15 | Incorrect | 0 ms | 17728 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17728 KB | Output is correct |
2 | Correct | 0 ms | 17728 KB | Output is correct |
3 | Correct | 0 ms | 17728 KB | Output is correct |
4 | Correct | 0 ms | 17728 KB | Output is correct |
5 | Correct | 0 ms | 17728 KB | Output is correct |
6 | Correct | 0 ms | 17728 KB | Output is correct |
7 | Correct | 0 ms | 17728 KB | Output is correct |
8 | Correct | 0 ms | 17728 KB | Output is correct |
9 | Correct | 0 ms | 17728 KB | Output is correct |
10 | Correct | 0 ms | 17728 KB | Output is correct |
11 | Correct | 0 ms | 17728 KB | Output is correct |
12 | Correct | 0 ms | 17728 KB | Output is correct |
13 | Correct | 0 ms | 17728 KB | Output is correct |
14 | Correct | 0 ms | 17728 KB | Output is correct |
15 | Incorrect | 0 ms | 17728 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17728 KB | Output is correct |
2 | Correct | 0 ms | 17728 KB | Output is correct |
3 | Correct | 0 ms | 17728 KB | Output is correct |
4 | Correct | 0 ms | 17728 KB | Output is correct |
5 | Correct | 0 ms | 17728 KB | Output is correct |
6 | Correct | 0 ms | 17728 KB | Output is correct |
7 | Correct | 0 ms | 17728 KB | Output is correct |
8 | Correct | 0 ms | 17728 KB | Output is correct |
9 | Correct | 0 ms | 17728 KB | Output is correct |
10 | Correct | 0 ms | 17728 KB | Output is correct |
11 | Correct | 0 ms | 17728 KB | Output is correct |
12 | Correct | 0 ms | 17728 KB | Output is correct |
13 | Correct | 0 ms | 17728 KB | Output is correct |
14 | Correct | 0 ms | 17728 KB | Output is correct |
15 | Correct | 0 ms | 17728 KB | Output is correct |
16 | Correct | 0 ms | 17728 KB | Output is correct |
17 | Correct | 0 ms | 17728 KB | Output is correct |
18 | Correct | 0 ms | 17728 KB | Output is correct |
19 | Correct | 0 ms | 17728 KB | Output is correct |
20 | Correct | 0 ms | 17728 KB | Output is correct |
21 | Correct | 0 ms | 17728 KB | Output is correct |
22 | Correct | 0 ms | 17728 KB | Output is correct |
23 | Correct | 0 ms | 17728 KB | Output is correct |
24 | Correct | 0 ms | 17728 KB | Output is correct |
25 | Correct | 0 ms | 17728 KB | Output is correct |
26 | Correct | 0 ms | 17728 KB | Output is correct |
27 | Correct | 0 ms | 17728 KB | Output is correct |
28 | Correct | 0 ms | 17728 KB | Output is correct |
29 | Correct | 0 ms | 17728 KB | Output is correct |
30 | Correct | 0 ms | 17728 KB | Output is correct |
31 | Correct | 0 ms | 17728 KB | Output is correct |
32 | Correct | 0 ms | 17728 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17728 KB | Output is correct |
2 | Correct | 0 ms | 17728 KB | Output is correct |
3 | Correct | 0 ms | 17728 KB | Output is correct |
4 | Correct | 0 ms | 17728 KB | Output is correct |
5 | Correct | 0 ms | 17728 KB | Output is correct |
6 | Correct | 0 ms | 17728 KB | Output is correct |
7 | Correct | 0 ms | 17728 KB | Output is correct |
8 | Correct | 0 ms | 17728 KB | Output is correct |
9 | Correct | 0 ms | 17728 KB | Output is correct |
10 | Correct | 0 ms | 17728 KB | Output is correct |
11 | Correct | 0 ms | 17728 KB | Output is correct |
12 | Correct | 0 ms | 17728 KB | Output is correct |
13 | Correct | 0 ms | 17728 KB | Output is correct |
14 | Correct | 0 ms | 17728 KB | Output is correct |
15 | Incorrect | 0 ms | 17728 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17728 KB | Output is correct |
2 | Correct | 0 ms | 17728 KB | Output is correct |
3 | Correct | 0 ms | 17728 KB | Output is correct |
4 | Correct | 0 ms | 17728 KB | Output is correct |
5 | Correct | 0 ms | 17728 KB | Output is correct |
6 | Correct | 0 ms | 17728 KB | Output is correct |
7 | Correct | 0 ms | 17728 KB | Output is correct |
8 | Correct | 0 ms | 17728 KB | Output is correct |
9 | Correct | 0 ms | 17728 KB | Output is correct |
10 | Correct | 0 ms | 17728 KB | Output is correct |
11 | Correct | 0 ms | 17728 KB | Output is correct |
12 | Correct | 0 ms | 17728 KB | Output is correct |
13 | Correct | 0 ms | 17728 KB | Output is correct |
14 | Incorrect | 0 ms | 17728 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |