# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45833 | 2018-04-16T08:49:14 Z | Extazy | Bali Sculptures (APIO15_sculpture) | C++17 | 12 ms | 1280 KB |
#include <bits/stdc++.h> #define endl '\n' using namespace std; const int N = 2007; const long long INF = 1000000000000007; int n,a,b; long long arr[N],ans; bool used[N][N]; long long state[N][N]; long long recurse(int pos, int groups) { if(pos>n) { if(groups==0) return 0; return INF; } if(used[pos][groups]) return state[pos][groups]; long long ans=INF; int i; for(i=pos;i<=n;i++) { if(recurse(i+1,groups-1)!=INF) ans=min(ans,(arr[i]-arr[pos-1])|recurse(i+1,groups-1)); } used[pos][groups]=true; return state[pos][groups]=ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); 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=INF; for(i=a;i<=b;i++) { if(recurse(1,i)!=INF) ans=min(ans,recurse(1,i)); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 2 ms | 652 KB | Output is correct |
7 | Correct | 2 ms | 688 KB | Output is correct |
8 | Correct | 2 ms | 688 KB | Output is correct |
9 | Correct | 2 ms | 688 KB | Output is correct |
10 | Correct | 2 ms | 748 KB | Output is correct |
11 | Correct | 2 ms | 748 KB | Output is correct |
12 | Correct | 2 ms | 764 KB | Output is correct |
13 | Correct | 2 ms | 764 KB | Output is correct |
14 | Correct | 2 ms | 764 KB | Output is correct |
15 | Correct | 2 ms | 764 KB | Output is correct |
16 | Correct | 2 ms | 764 KB | Output is correct |
17 | Correct | 2 ms | 764 KB | Output is correct |
18 | Correct | 2 ms | 764 KB | Output is correct |
19 | Correct | 2 ms | 764 KB | Output is correct |
20 | Correct | 2 ms | 764 KB | Output is correct |
21 | Incorrect | 2 ms | 764 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 764 KB | Output is correct |
2 | Correct | 2 ms | 764 KB | Output is correct |
3 | Correct | 2 ms | 764 KB | Output is correct |
4 | Correct | 2 ms | 764 KB | Output is correct |
5 | Correct | 2 ms | 764 KB | Output is correct |
6 | Correct | 2 ms | 764 KB | Output is correct |
7 | Correct | 2 ms | 764 KB | Output is correct |
8 | Correct | 2 ms | 776 KB | Output is correct |
9 | Correct | 2 ms | 884 KB | Output is correct |
10 | Correct | 2 ms | 884 KB | Output is correct |
11 | Correct | 2 ms | 884 KB | Output is correct |
12 | Correct | 2 ms | 884 KB | Output is correct |
13 | Correct | 2 ms | 884 KB | Output is correct |
14 | Correct | 2 ms | 884 KB | Output is correct |
15 | Correct | 2 ms | 884 KB | Output is correct |
16 | Correct | 2 ms | 884 KB | Output is correct |
17 | Correct | 2 ms | 884 KB | Output is correct |
18 | Correct | 2 ms | 884 KB | Output is correct |
19 | Correct | 2 ms | 884 KB | Output is correct |
20 | Correct | 2 ms | 884 KB | Output is correct |
21 | Incorrect | 2 ms | 884 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 884 KB | Output is correct |
2 | Correct | 2 ms | 884 KB | Output is correct |
3 | Correct | 2 ms | 884 KB | Output is correct |
4 | Correct | 2 ms | 884 KB | Output is correct |
5 | Correct | 2 ms | 884 KB | Output is correct |
6 | Correct | 2 ms | 884 KB | Output is correct |
7 | Correct | 2 ms | 884 KB | Output is correct |
8 | Correct | 2 ms | 884 KB | Output is correct |
9 | Correct | 2 ms | 884 KB | Output is correct |
10 | Correct | 2 ms | 884 KB | Output is correct |
11 | Correct | 2 ms | 884 KB | Output is correct |
12 | Correct | 2 ms | 884 KB | Output is correct |
13 | Correct | 2 ms | 884 KB | Output is correct |
14 | Correct | 2 ms | 884 KB | Output is correct |
15 | Correct | 2 ms | 884 KB | Output is correct |
16 | Correct | 2 ms | 892 KB | Output is correct |
17 | Correct | 2 ms | 892 KB | Output is correct |
18 | Correct | 2 ms | 896 KB | Output is correct |
19 | Correct | 3 ms | 896 KB | Output is correct |
20 | Correct | 2 ms | 896 KB | Output is correct |
21 | Correct | 2 ms | 896 KB | Output is correct |
22 | Correct | 2 ms | 896 KB | Output is correct |
23 | Correct | 2 ms | 896 KB | Output is correct |
24 | Correct | 3 ms | 896 KB | Output is correct |
25 | Correct | 3 ms | 1020 KB | Output is correct |
26 | Correct | 3 ms | 1148 KB | Output is correct |
27 | Correct | 5 ms | 1276 KB | Output is correct |
28 | Correct | 7 ms | 1276 KB | Output is correct |
29 | Correct | 12 ms | 1276 KB | Output is correct |
30 | Correct | 3 ms | 1276 KB | Output is correct |
31 | Correct | 6 ms | 1276 KB | Output is correct |
32 | Correct | 6 ms | 1276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1276 KB | Output is correct |
2 | Correct | 3 ms | 1276 KB | Output is correct |
3 | Correct | 2 ms | 1276 KB | Output is correct |
4 | Correct | 2 ms | 1276 KB | Output is correct |
5 | Correct | 2 ms | 1276 KB | Output is correct |
6 | Correct | 2 ms | 1276 KB | Output is correct |
7 | Correct | 2 ms | 1276 KB | Output is correct |
8 | Correct | 2 ms | 1276 KB | Output is correct |
9 | Correct | 2 ms | 1276 KB | Output is correct |
10 | Correct | 2 ms | 1276 KB | Output is correct |
11 | Correct | 2 ms | 1276 KB | Output is correct |
12 | Correct | 2 ms | 1276 KB | Output is correct |
13 | Correct | 2 ms | 1276 KB | Output is correct |
14 | Correct | 2 ms | 1276 KB | Output is correct |
15 | Correct | 2 ms | 1276 KB | Output is correct |
16 | Correct | 2 ms | 1276 KB | Output is correct |
17 | Correct | 2 ms | 1276 KB | Output is correct |
18 | Correct | 2 ms | 1276 KB | Output is correct |
19 | Correct | 2 ms | 1276 KB | Output is correct |
20 | Correct | 2 ms | 1276 KB | Output is correct |
21 | Incorrect | 2 ms | 1276 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1276 KB | Output is correct |
2 | Correct | 2 ms | 1276 KB | Output is correct |
3 | Correct | 2 ms | 1276 KB | Output is correct |
4 | Correct | 2 ms | 1276 KB | Output is correct |
5 | Correct | 2 ms | 1276 KB | Output is correct |
6 | Correct | 2 ms | 1276 KB | Output is correct |
7 | Correct | 2 ms | 1276 KB | Output is correct |
8 | Correct | 2 ms | 1276 KB | Output is correct |
9 | Correct | 2 ms | 1276 KB | Output is correct |
10 | Correct | 2 ms | 1276 KB | Output is correct |
11 | Correct | 2 ms | 1276 KB | Output is correct |
12 | Correct | 2 ms | 1276 KB | Output is correct |
13 | Correct | 3 ms | 1276 KB | Output is correct |
14 | Correct | 2 ms | 1276 KB | Output is correct |
15 | Correct | 2 ms | 1276 KB | Output is correct |
16 | Correct | 2 ms | 1276 KB | Output is correct |
17 | Correct | 2 ms | 1276 KB | Output is correct |
18 | Correct | 2 ms | 1276 KB | Output is correct |
19 | Correct | 2 ms | 1276 KB | Output is correct |
20 | Correct | 2 ms | 1276 KB | Output is correct |
21 | Correct | 2 ms | 1276 KB | Output is correct |
22 | Correct | 2 ms | 1276 KB | Output is correct |
23 | Correct | 2 ms | 1276 KB | Output is correct |
24 | Correct | 2 ms | 1276 KB | Output is correct |
25 | Correct | 2 ms | 1276 KB | Output is correct |
26 | Correct | 2 ms | 1276 KB | Output is correct |
27 | Correct | 3 ms | 1276 KB | Output is correct |
28 | Correct | 2 ms | 1276 KB | Output is correct |
29 | Correct | 2 ms | 1276 KB | Output is correct |
30 | Correct | 2 ms | 1276 KB | Output is correct |
31 | Correct | 2 ms | 1276 KB | Output is correct |
32 | Correct | 3 ms | 1276 KB | Output is correct |
33 | Correct | 2 ms | 1276 KB | Output is correct |
34 | Correct | 3 ms | 1276 KB | Output is correct |
35 | Correct | 3 ms | 1276 KB | Output is correct |
36 | Correct | 3 ms | 1276 KB | Output is correct |
37 | Correct | 5 ms | 1276 KB | Output is correct |
38 | Correct | 7 ms | 1276 KB | Output is correct |
39 | Correct | 8 ms | 1276 KB | Output is correct |
40 | Correct | 4 ms | 1280 KB | Output is correct |
41 | Correct | 6 ms | 1280 KB | Output is correct |
42 | Correct | 7 ms | 1280 KB | Output is correct |
43 | Incorrect | 2 ms | 1280 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |