# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44288 | 2018-03-31T09:04:39 Z | Extazy | Bali Sculptures (APIO15_sculpture) | C++17 | 7 ms | 2152 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2007; int n,a,b; long long ans; bool used[N][N]; long long state[N][N]; long long arr[N]; long long get_sum(int l, int r) { return arr[r]-arr[l-1]; } long long recurse(int pos, int groups) { if(groups<0) return 1000000000000000000; if(pos>n) { if(groups==0) return 0; return 1000000000000000000; } if(used[pos][groups]) return state[pos][groups]; int i; long long ans=1000000000000000000; for(i=pos;i<=n;i++) { ans=min(ans,recurse(i+1,groups-1)|get_sum(pos,i)); } used[pos][groups]=true; return state[pos][groups]=ans; } int main() { int i; scanf("%d %d %d", &n, &a, &b); for(i=1;i<=n;i++) { scanf("%lld", &arr[i]); arr[i]+=arr[i-1]; } ans=recurse(1,a); while(++a<=b) ans=min(ans,recurse(1,a)); printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 608 KB | Output is correct |
3 | Correct | 2 ms | 608 KB | Output is correct |
4 | Correct | 2 ms | 612 KB | Output is correct |
5 | Correct | 2 ms | 616 KB | Output is correct |
6 | Correct | 2 ms | 808 KB | Output is correct |
7 | Correct | 2 ms | 848 KB | Output is correct |
8 | Correct | 2 ms | 1004 KB | Output is correct |
9 | Correct | 2 ms | 1004 KB | Output is correct |
10 | Correct | 2 ms | 1004 KB | Output is correct |
11 | Correct | 2 ms | 1004 KB | Output is correct |
12 | Correct | 2 ms | 1004 KB | Output is correct |
13 | Correct | 2 ms | 1004 KB | Output is correct |
14 | Correct | 2 ms | 1004 KB | Output is correct |
15 | Correct | 2 ms | 1004 KB | Output is correct |
16 | Correct | 2 ms | 1004 KB | Output is correct |
17 | Correct | 2 ms | 1004 KB | Output is correct |
18 | Correct | 2 ms | 1004 KB | Output is correct |
19 | Correct | 2 ms | 1004 KB | Output is correct |
20 | Correct | 2 ms | 1004 KB | Output is correct |
21 | Incorrect | 2 ms | 1004 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1004 KB | Output is correct |
2 | Correct | 2 ms | 1004 KB | Output is correct |
3 | Correct | 2 ms | 1004 KB | Output is correct |
4 | Correct | 2 ms | 1004 KB | Output is correct |
5 | Correct | 2 ms | 1004 KB | Output is correct |
6 | Correct | 2 ms | 1020 KB | Output is correct |
7 | Correct | 2 ms | 1020 KB | Output is correct |
8 | Correct | 2 ms | 1020 KB | Output is correct |
9 | Correct | 2 ms | 1020 KB | Output is correct |
10 | Correct | 2 ms | 1020 KB | Output is correct |
11 | Correct | 2 ms | 1020 KB | Output is correct |
12 | Correct | 2 ms | 1020 KB | Output is correct |
13 | Correct | 2 ms | 1020 KB | Output is correct |
14 | Correct | 2 ms | 1020 KB | Output is correct |
15 | Correct | 2 ms | 1020 KB | Output is correct |
16 | Correct | 2 ms | 1020 KB | Output is correct |
17 | Correct | 2 ms | 1020 KB | Output is correct |
18 | Correct | 2 ms | 1020 KB | Output is correct |
19 | Correct | 2 ms | 1020 KB | Output is correct |
20 | Correct | 2 ms | 1020 KB | Output is correct |
21 | Incorrect | 2 ms | 1148 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1148 KB | Output is correct |
2 | Correct | 2 ms | 1148 KB | Output is correct |
3 | Correct | 2 ms | 1148 KB | Output is correct |
4 | Correct | 2 ms | 1148 KB | Output is correct |
5 | Correct | 2 ms | 1148 KB | Output is correct |
6 | Correct | 2 ms | 1148 KB | Output is correct |
7 | Correct | 2 ms | 1148 KB | Output is correct |
8 | Correct | 2 ms | 1148 KB | Output is correct |
9 | Correct | 2 ms | 1148 KB | Output is correct |
10 | Correct | 2 ms | 1148 KB | Output is correct |
11 | Correct | 2 ms | 1148 KB | Output is correct |
12 | Correct | 2 ms | 1148 KB | Output is correct |
13 | Correct | 2 ms | 1148 KB | Output is correct |
14 | Correct | 2 ms | 1240 KB | Output is correct |
15 | Correct | 2 ms | 1244 KB | Output is correct |
16 | Correct | 2 ms | 1248 KB | Output is correct |
17 | Correct | 2 ms | 1380 KB | Output is correct |
18 | Correct | 2 ms | 1384 KB | Output is correct |
19 | Correct | 2 ms | 1388 KB | Output is correct |
20 | Correct | 2 ms | 1388 KB | Output is correct |
21 | Correct | 3 ms | 1396 KB | Output is correct |
22 | Correct | 2 ms | 1400 KB | Output is correct |
23 | Correct | 2 ms | 1400 KB | Output is correct |
24 | Correct | 2 ms | 1408 KB | Output is correct |
25 | Correct | 2 ms | 1544 KB | Output is correct |
26 | Correct | 3 ms | 1544 KB | Output is correct |
27 | Correct | 4 ms | 1680 KB | Output is correct |
28 | Correct | 5 ms | 1808 KB | Output is correct |
29 | Correct | 7 ms | 1812 KB | Output is correct |
30 | Correct | 2 ms | 1812 KB | Output is correct |
31 | Correct | 4 ms | 1812 KB | Output is correct |
32 | Correct | 5 ms | 1824 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1824 KB | Output is correct |
2 | Correct | 2 ms | 1824 KB | Output is correct |
3 | Correct | 2 ms | 1824 KB | Output is correct |
4 | Correct | 2 ms | 1824 KB | Output is correct |
5 | Correct | 2 ms | 1824 KB | Output is correct |
6 | Correct | 2 ms | 1824 KB | Output is correct |
7 | Correct | 2 ms | 1824 KB | Output is correct |
8 | Correct | 2 ms | 1824 KB | Output is correct |
9 | Correct | 3 ms | 1824 KB | Output is correct |
10 | Correct | 2 ms | 1824 KB | Output is correct |
11 | Correct | 2 ms | 1824 KB | Output is correct |
12 | Correct | 2 ms | 1824 KB | Output is correct |
13 | Correct | 2 ms | 1824 KB | Output is correct |
14 | Correct | 2 ms | 1824 KB | Output is correct |
15 | Correct | 2 ms | 1824 KB | Output is correct |
16 | Correct | 2 ms | 1824 KB | Output is correct |
17 | Correct | 2 ms | 1824 KB | Output is correct |
18 | Correct | 2 ms | 1824 KB | Output is correct |
19 | Correct | 2 ms | 1824 KB | Output is correct |
20 | Correct | 2 ms | 1824 KB | Output is correct |
21 | Incorrect | 2 ms | 1824 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1824 KB | Output is correct |
2 | Correct | 2 ms | 1824 KB | Output is correct |
3 | Correct | 2 ms | 1824 KB | Output is correct |
4 | Correct | 2 ms | 1824 KB | Output is correct |
5 | Correct | 2 ms | 1824 KB | Output is correct |
6 | Correct | 2 ms | 1824 KB | Output is correct |
7 | Correct | 2 ms | 1824 KB | Output is correct |
8 | Correct | 2 ms | 1824 KB | Output is correct |
9 | Correct | 2 ms | 1824 KB | Output is correct |
10 | Correct | 2 ms | 1824 KB | Output is correct |
11 | Correct | 2 ms | 1824 KB | Output is correct |
12 | Correct | 2 ms | 1824 KB | Output is correct |
13 | Correct | 2 ms | 1824 KB | Output is correct |
14 | Correct | 2 ms | 1824 KB | Output is correct |
15 | Correct | 2 ms | 1824 KB | Output is correct |
16 | Correct | 2 ms | 1824 KB | Output is correct |
17 | Correct | 3 ms | 1824 KB | Output is correct |
18 | Correct | 2 ms | 1824 KB | Output is correct |
19 | Correct | 2 ms | 1824 KB | Output is correct |
20 | Correct | 2 ms | 1824 KB | Output is correct |
21 | Correct | 2 ms | 1824 KB | Output is correct |
22 | Correct | 2 ms | 1824 KB | Output is correct |
23 | Correct | 2 ms | 1824 KB | Output is correct |
24 | Correct | 2 ms | 1824 KB | Output is correct |
25 | Correct | 2 ms | 1824 KB | Output is correct |
26 | Correct | 3 ms | 1824 KB | Output is correct |
27 | Correct | 2 ms | 1824 KB | Output is correct |
28 | Correct | 3 ms | 1824 KB | Output is correct |
29 | Correct | 3 ms | 1824 KB | Output is correct |
30 | Correct | 2 ms | 1824 KB | Output is correct |
31 | Correct | 3 ms | 1824 KB | Output is correct |
32 | Correct | 2 ms | 1824 KB | Output is correct |
33 | Correct | 3 ms | 1824 KB | Output is correct |
34 | Correct | 3 ms | 1824 KB | Output is correct |
35 | Correct | 2 ms | 1868 KB | Output is correct |
36 | Correct | 3 ms | 1872 KB | Output is correct |
37 | Correct | 4 ms | 2028 KB | Output is correct |
38 | Correct | 6 ms | 2080 KB | Output is correct |
39 | Correct | 6 ms | 2140 KB | Output is correct |
40 | Correct | 3 ms | 2140 KB | Output is correct |
41 | Correct | 4 ms | 2140 KB | Output is correct |
42 | Correct | 6 ms | 2152 KB | Output is correct |
43 | Incorrect | 2 ms | 2152 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |