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