# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31132 | 2017-08-10T22:53:59 Z | nibnalin | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 28016 KB |
#include <iostream> #include <cstdio> #include <vector> using namespace std; typedef long long int lli; const lli maxn = 55, inf = lli(1e14)+5; lli n, a, b, ans = inf, A[maxn], memo[maxn][maxn][maxn*20]; void DP(lli idx, lli p, lli mask) { if(idx == n+1) { if(a <= p && p <= b) ans = min(ans, mask); else return; } else if(p > b) return; else if(memo[idx][p][mask]) return; else { for(lli i = idx;i <= n;i++) DP(i+1, p+1, mask|(A[i]-A[idx-1])); } } int main(void) { scanf("%lld%lld%lld", &n, &a, &b); for(lli i = 1;i <= n;i++) scanf("%lld", &A[i]); for(lli i = 1;i <= n;i++) A[i] += A[i-1]; DP(1, 0, 0); printf("%lld\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 28016 KB | Output is correct |
2 | Correct | 0 ms | 28016 KB | Output is correct |
3 | Correct | 0 ms | 28016 KB | Output is correct |
4 | Correct | 0 ms | 28016 KB | Output is correct |
5 | Correct | 0 ms | 28016 KB | Output is correct |
6 | Correct | 0 ms | 28016 KB | Output is correct |
7 | Correct | 0 ms | 28016 KB | Output is correct |
8 | Correct | 0 ms | 28016 KB | Output is correct |
9 | Correct | 0 ms | 28016 KB | Output is correct |
10 | Correct | 0 ms | 28016 KB | Output is correct |
11 | Correct | 0 ms | 28016 KB | Output is correct |
12 | Correct | 0 ms | 28016 KB | Output is correct |
13 | Correct | 3 ms | 28016 KB | Output is correct |
14 | Correct | 0 ms | 28016 KB | Output is correct |
15 | Correct | 0 ms | 28016 KB | Output is correct |
16 | Correct | 0 ms | 28016 KB | Output is correct |
17 | Correct | 0 ms | 28016 KB | Output is correct |
18 | Correct | 0 ms | 28016 KB | Output is correct |
19 | Correct | 0 ms | 28016 KB | Output is correct |
20 | Correct | 0 ms | 28016 KB | Output is correct |
21 | Correct | 0 ms | 28016 KB | Output is correct |
22 | Correct | 0 ms | 28016 KB | Output is correct |
23 | Correct | 0 ms | 28016 KB | Output is correct |
24 | Correct | 0 ms | 28016 KB | Output is correct |
25 | Correct | 0 ms | 28016 KB | Output is correct |
26 | Correct | 3 ms | 28016 KB | Output is correct |
27 | Runtime error | 0 ms | 28016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 28016 KB | Output is correct |
2 | Correct | 0 ms | 28016 KB | Output is correct |
3 | Correct | 0 ms | 28016 KB | Output is correct |
4 | Correct | 0 ms | 28016 KB | Output is correct |
5 | Correct | 0 ms | 28016 KB | Output is correct |
6 | Correct | 0 ms | 28016 KB | Output is correct |
7 | Correct | 0 ms | 28016 KB | Output is correct |
8 | Correct | 0 ms | 28016 KB | Output is correct |
9 | Correct | 0 ms | 28016 KB | Output is correct |
10 | Correct | 0 ms | 28016 KB | Output is correct |
11 | Correct | 0 ms | 28016 KB | Output is correct |
12 | Correct | 0 ms | 28016 KB | Output is correct |
13 | Correct | 3 ms | 28016 KB | Output is correct |
14 | Correct | 0 ms | 28016 KB | Output is correct |
15 | Correct | 0 ms | 28016 KB | Output is correct |
16 | Correct | 0 ms | 28016 KB | Output is correct |
17 | Correct | 0 ms | 28016 KB | Output is correct |
18 | Correct | 0 ms | 28016 KB | Output is correct |
19 | Correct | 0 ms | 28016 KB | Output is correct |
20 | Correct | 0 ms | 28016 KB | Output is correct |
21 | Correct | 0 ms | 28016 KB | Output is correct |
22 | Correct | 0 ms | 28016 KB | Output is correct |
23 | Correct | 0 ms | 28016 KB | Output is correct |
24 | Correct | 0 ms | 28016 KB | Output is correct |
25 | Correct | 0 ms | 28016 KB | Output is correct |
26 | Correct | 3 ms | 28016 KB | Output is correct |
27 | Correct | 9 ms | 28016 KB | Output is correct |
28 | Correct | 56 ms | 28016 KB | Output is correct |
29 | Correct | 13 ms | 28016 KB | Output is correct |
30 | Execution timed out | 1000 ms | 28016 KB | Execution timed out |
31 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 28016 KB | Output is correct |
2 | Correct | 0 ms | 28016 KB | Output is correct |
3 | Correct | 0 ms | 28016 KB | Output is correct |
4 | Correct | 0 ms | 28016 KB | Output is correct |
5 | Correct | 0 ms | 28016 KB | Output is correct |
6 | Correct | 0 ms | 28016 KB | Output is correct |
7 | Correct | 0 ms | 28016 KB | Output is correct |
8 | Correct | 0 ms | 28016 KB | Output is correct |
9 | Correct | 0 ms | 28016 KB | Output is correct |
10 | Correct | 0 ms | 28016 KB | Output is correct |
11 | Correct | 0 ms | 28016 KB | Output is correct |
12 | Correct | 0 ms | 28016 KB | Output is correct |
13 | Correct | 3 ms | 28016 KB | Output is correct |
14 | Correct | 16 ms | 28016 KB | Output is correct |
15 | Correct | 66 ms | 28016 KB | Output is correct |
16 | Correct | 16 ms | 28016 KB | Output is correct |
17 | Execution timed out | 1000 ms | 28016 KB | Execution timed out |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 28016 KB | Output is correct |
2 | Correct | 0 ms | 28016 KB | Output is correct |
3 | Correct | 0 ms | 28016 KB | Output is correct |
4 | Correct | 0 ms | 28016 KB | Output is correct |
5 | Correct | 0 ms | 28016 KB | Output is correct |
6 | Correct | 0 ms | 28016 KB | Output is correct |
7 | Correct | 0 ms | 28016 KB | Output is correct |
8 | Correct | 0 ms | 28016 KB | Output is correct |
9 | Correct | 0 ms | 28016 KB | Output is correct |
10 | Correct | 0 ms | 28016 KB | Output is correct |
11 | Correct | 0 ms | 28016 KB | Output is correct |
12 | Correct | 0 ms | 28016 KB | Output is correct |
13 | Correct | 3 ms | 28016 KB | Output is correct |
14 | Correct | 0 ms | 28016 KB | Output is correct |
15 | Correct | 0 ms | 28016 KB | Output is correct |
16 | Correct | 0 ms | 28016 KB | Output is correct |
17 | Correct | 0 ms | 28016 KB | Output is correct |
18 | Correct | 0 ms | 28016 KB | Output is correct |
19 | Correct | 0 ms | 28016 KB | Output is correct |
20 | Correct | 0 ms | 28016 KB | Output is correct |
21 | Correct | 0 ms | 28016 KB | Output is correct |
22 | Correct | 0 ms | 28016 KB | Output is correct |
23 | Correct | 0 ms | 28016 KB | Output is correct |
24 | Correct | 0 ms | 28016 KB | Output is correct |
25 | Correct | 0 ms | 28016 KB | Output is correct |
26 | Correct | 3 ms | 28016 KB | Output is correct |
27 | Runtime error | 0 ms | 28016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 28016 KB | Output is correct |
2 | Correct | 0 ms | 28016 KB | Output is correct |
3 | Correct | 0 ms | 28016 KB | Output is correct |
4 | Correct | 0 ms | 28016 KB | Output is correct |
5 | Correct | 0 ms | 28016 KB | Output is correct |
6 | Correct | 0 ms | 28016 KB | Output is correct |
7 | Correct | 0 ms | 28016 KB | Output is correct |
8 | Correct | 0 ms | 28016 KB | Output is correct |
9 | Correct | 0 ms | 28016 KB | Output is correct |
10 | Correct | 0 ms | 28016 KB | Output is correct |
11 | Correct | 0 ms | 28016 KB | Output is correct |
12 | Correct | 0 ms | 28016 KB | Output is correct |
13 | Correct | 3 ms | 28016 KB | Output is correct |
14 | Runtime error | 0 ms | 28016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Halted | 0 ms | 0 KB | - |