# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
43777 | 2018-03-23T11:34:31 Z | Extazy | Bali Sculptures (APIO15_sculpture) | C++14 | 6 ms | 2120 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 1; } 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 468 KB | Output is correct |
3 | Correct | 2 ms | 580 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Correct | 2 ms | 580 KB | Output is correct |
7 | Correct | 2 ms | 708 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 756 KB | Output is correct |
10 | Correct | 2 ms | 760 KB | Output is correct |
11 | Correct | 2 ms | 760 KB | Output is correct |
12 | Correct | 2 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 824 KB | Output is correct |
14 | Correct | 2 ms | 824 KB | Output is correct |
15 | Correct | 2 ms | 824 KB | Output is correct |
16 | Correct | 2 ms | 824 KB | Output is correct |
17 | Correct | 2 ms | 824 KB | Output is correct |
18 | Correct | 2 ms | 824 KB | Output is correct |
19 | Correct | 2 ms | 824 KB | Output is correct |
20 | Correct | 2 ms | 824 KB | Output is correct |
21 | Incorrect | 2 ms | 824 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 824 KB | Output is correct |
2 | Correct | 1 ms | 824 KB | Output is correct |
3 | Correct | 2 ms | 824 KB | Output is correct |
4 | Correct | 2 ms | 824 KB | Output is correct |
5 | Correct | 1 ms | 824 KB | Output is correct |
6 | Correct | 2 ms | 824 KB | Output is correct |
7 | Correct | 2 ms | 828 KB | Output is correct |
8 | Correct | 3 ms | 864 KB | Output is correct |
9 | Correct | 2 ms | 864 KB | Output is correct |
10 | Correct | 2 ms | 864 KB | Output is correct |
11 | Correct | 1 ms | 864 KB | Output is correct |
12 | Correct | 2 ms | 864 KB | Output is correct |
13 | Correct | 2 ms | 864 KB | Output is correct |
14 | Correct | 1 ms | 864 KB | Output is correct |
15 | Correct | 2 ms | 864 KB | Output is correct |
16 | Correct | 2 ms | 864 KB | Output is correct |
17 | Correct | 2 ms | 868 KB | Output is correct |
18 | Correct | 1 ms | 868 KB | Output is correct |
19 | Correct | 2 ms | 876 KB | Output is correct |
20 | Correct | 2 ms | 880 KB | Output is correct |
21 | Incorrect | 2 ms | 884 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 888 KB | Output is correct |
2 | Correct | 2 ms | 892 KB | Output is correct |
3 | Correct | 2 ms | 896 KB | Output is correct |
4 | Correct | 2 ms | 1016 KB | Output is correct |
5 | Correct | 2 ms | 1016 KB | Output is correct |
6 | Correct | 2 ms | 1016 KB | Output is correct |
7 | Correct | 1 ms | 1016 KB | Output is correct |
8 | Correct | 2 ms | 1016 KB | Output is correct |
9 | Correct | 2 ms | 1016 KB | Output is correct |
10 | Correct | 2 ms | 1016 KB | Output is correct |
11 | Correct | 2 ms | 1016 KB | Output is correct |
12 | Correct | 2 ms | 1016 KB | Output is correct |
13 | Correct | 1 ms | 1016 KB | Output is correct |
14 | Correct | 2 ms | 1068 KB | Output is correct |
15 | Correct | 2 ms | 1072 KB | Output is correct |
16 | Correct | 2 ms | 1076 KB | Output is correct |
17 | Correct | 2 ms | 1208 KB | Output is correct |
18 | Correct | 2 ms | 1212 KB | Output is correct |
19 | Correct | 2 ms | 1284 KB | Output is correct |
20 | Correct | 2 ms | 1284 KB | Output is correct |
21 | Correct | 2 ms | 1284 KB | Output is correct |
22 | Correct | 2 ms | 1284 KB | Output is correct |
23 | Correct | 2 ms | 1284 KB | Output is correct |
24 | Correct | 2 ms | 1284 KB | Output is correct |
25 | Correct | 2 ms | 1372 KB | Output is correct |
26 | Correct | 3 ms | 1376 KB | Output is correct |
27 | Correct | 4 ms | 1508 KB | Output is correct |
28 | Correct | 5 ms | 1640 KB | Output is correct |
29 | Correct | 6 ms | 1772 KB | Output is correct |
30 | Correct | 2 ms | 1772 KB | Output is correct |
31 | Correct | 3 ms | 1772 KB | Output is correct |
32 | Correct | 5 ms | 1772 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1772 KB | Output is correct |
2 | Correct | 2 ms | 1772 KB | Output is correct |
3 | Correct | 2 ms | 1772 KB | Output is correct |
4 | Correct | 1 ms | 1772 KB | Output is correct |
5 | Correct | 1 ms | 1772 KB | Output is correct |
6 | Correct | 2 ms | 1772 KB | Output is correct |
7 | Correct | 2 ms | 1772 KB | Output is correct |
8 | Correct | 1 ms | 1772 KB | Output is correct |
9 | Correct | 2 ms | 1772 KB | Output is correct |
10 | Correct | 2 ms | 1772 KB | Output is correct |
11 | Correct | 2 ms | 1772 KB | Output is correct |
12 | Correct | 2 ms | 1772 KB | Output is correct |
13 | Correct | 1 ms | 1772 KB | Output is correct |
14 | Correct | 2 ms | 1772 KB | Output is correct |
15 | Correct | 2 ms | 1772 KB | Output is correct |
16 | Correct | 1 ms | 1772 KB | Output is correct |
17 | Correct | 1 ms | 1772 KB | Output is correct |
18 | Correct | 1 ms | 1772 KB | Output is correct |
19 | Correct | 1 ms | 1772 KB | Output is correct |
20 | Correct | 2 ms | 1772 KB | Output is correct |
21 | Incorrect | 2 ms | 1772 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1772 KB | Output is correct |
2 | Correct | 2 ms | 1772 KB | Output is correct |
3 | Correct | 1 ms | 1772 KB | Output is correct |
4 | Correct | 2 ms | 1772 KB | Output is correct |
5 | Correct | 2 ms | 1772 KB | Output is correct |
6 | Correct | 2 ms | 1772 KB | Output is correct |
7 | Correct | 2 ms | 1772 KB | Output is correct |
8 | Correct | 2 ms | 1772 KB | Output is correct |
9 | Correct | 2 ms | 1772 KB | Output is correct |
10 | Correct | 2 ms | 1772 KB | Output is correct |
11 | Correct | 2 ms | 1772 KB | Output is correct |
12 | Correct | 2 ms | 1772 KB | Output is correct |
13 | Correct | 2 ms | 1772 KB | Output is correct |
14 | Correct | 2 ms | 1772 KB | Output is correct |
15 | Correct | 2 ms | 1772 KB | Output is correct |
16 | Correct | 2 ms | 1772 KB | Output is correct |
17 | Correct | 2 ms | 1772 KB | Output is correct |
18 | Correct | 1 ms | 1772 KB | Output is correct |
19 | Correct | 2 ms | 1772 KB | Output is correct |
20 | Correct | 1 ms | 1772 KB | Output is correct |
21 | Correct | 2 ms | 1772 KB | Output is correct |
22 | Correct | 2 ms | 1772 KB | Output is correct |
23 | Correct | 2 ms | 1772 KB | Output is correct |
24 | Correct | 2 ms | 1772 KB | Output is correct |
25 | Correct | 2 ms | 1772 KB | Output is correct |
26 | Correct | 2 ms | 1772 KB | Output is correct |
27 | Correct | 2 ms | 1772 KB | Output is correct |
28 | Correct | 2 ms | 1772 KB | Output is correct |
29 | Correct | 2 ms | 1772 KB | Output is correct |
30 | Correct | 2 ms | 1772 KB | Output is correct |
31 | Correct | 2 ms | 1772 KB | Output is correct |
32 | Correct | 2 ms | 1772 KB | Output is correct |
33 | Correct | 2 ms | 1772 KB | Output is correct |
34 | Correct | 2 ms | 1772 KB | Output is correct |
35 | Correct | 2 ms | 1832 KB | Output is correct |
36 | Correct | 3 ms | 1836 KB | Output is correct |
37 | Correct | 3 ms | 1972 KB | Output is correct |
38 | Correct | 5 ms | 2100 KB | Output is correct |
39 | Correct | 6 ms | 2104 KB | Output is correct |
40 | Correct | 2 ms | 2104 KB | Output is correct |
41 | Correct | 3 ms | 2104 KB | Output is correct |
42 | Correct | 5 ms | 2120 KB | Output is correct |
43 | Incorrect | 2 ms | 2120 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |