# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1077149 | 2024-08-27T01:49:42 Z | duyhoanho | K개의 묶음 (IZhO14_blocks) | C++14 | 1000 ms | 80340 KB |
#include <bits/stdc++.h> #define task "" #define int long long #define forinc(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int N=1e5+10; int n,a[N],dp[N][102],k; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); if (fopen ("blocks.in", "r")) { freopen ("blocks.in", "r", stdin); freopen ("blocks.out", "w", stdout); } cin>>n>>k; memset(dp,99,sizeof dp); int mx=0; forinc(i,1,n) { cin>>a[i]; mx=max(mx,a[i]); dp[i][1] = mx; dp[i][0]=0; } dp[0][0]=0; for(int i=2;i<=n;i++) { for(int j=2;j<=k;j++) { int mx=a[i]; for(int tt=i-1;tt>=1;tt--) { dp[i][j] = min(dp[i][j],dp[tt][j-1] + mx); mx=max(mx,a[tt]); } } } // forinc(i,1,n) // { // forinc(j,1,k) cout<<dp[i][j]<<" "; // cout<<"\n"; // } cout<<dp[n][k]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 80160 KB | Output is correct |
2 | Correct | 34 ms | 80220 KB | Output is correct |
3 | Correct | 35 ms | 80208 KB | Output is correct |
4 | Correct | 34 ms | 80220 KB | Output is correct |
5 | Correct | 31 ms | 80220 KB | Output is correct |
6 | Correct | 33 ms | 80212 KB | Output is correct |
7 | Correct | 30 ms | 80124 KB | Output is correct |
8 | Correct | 33 ms | 80208 KB | Output is correct |
9 | Correct | 32 ms | 80064 KB | Output is correct |
10 | Correct | 32 ms | 80212 KB | Output is correct |
11 | Correct | 32 ms | 80220 KB | Output is correct |
12 | Correct | 33 ms | 80212 KB | Output is correct |
13 | Correct | 34 ms | 80136 KB | Output is correct |
14 | Correct | 33 ms | 80248 KB | Output is correct |
15 | Correct | 33 ms | 80220 KB | Output is correct |
16 | Correct | 34 ms | 80212 KB | Output is correct |
17 | Correct | 35 ms | 80256 KB | Output is correct |
18 | Correct | 34 ms | 80216 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 80196 KB | Output is correct |
2 | Correct | 33 ms | 80220 KB | Output is correct |
3 | Correct | 33 ms | 80216 KB | Output is correct |
4 | Correct | 32 ms | 80220 KB | Output is correct |
5 | Correct | 34 ms | 80064 KB | Output is correct |
6 | Correct | 34 ms | 80216 KB | Output is correct |
7 | Correct | 34 ms | 80220 KB | Output is correct |
8 | Correct | 34 ms | 80212 KB | Output is correct |
9 | Correct | 44 ms | 80044 KB | Output is correct |
10 | Correct | 35 ms | 80208 KB | Output is correct |
11 | Correct | 33 ms | 80208 KB | Output is correct |
12 | Correct | 41 ms | 80180 KB | Output is correct |
13 | Correct | 35 ms | 80212 KB | Output is correct |
14 | Correct | 35 ms | 80212 KB | Output is correct |
15 | Correct | 35 ms | 80096 KB | Output is correct |
16 | Correct | 34 ms | 80208 KB | Output is correct |
17 | Correct | 35 ms | 80212 KB | Output is correct |
18 | Correct | 35 ms | 80212 KB | Output is correct |
19 | Correct | 33 ms | 80212 KB | Output is correct |
20 | Correct | 34 ms | 80216 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 80160 KB | Output is correct |
2 | Correct | 34 ms | 80220 KB | Output is correct |
3 | Correct | 35 ms | 80208 KB | Output is correct |
4 | Correct | 34 ms | 80220 KB | Output is correct |
5 | Correct | 31 ms | 80220 KB | Output is correct |
6 | Correct | 33 ms | 80212 KB | Output is correct |
7 | Correct | 30 ms | 80124 KB | Output is correct |
8 | Correct | 33 ms | 80208 KB | Output is correct |
9 | Correct | 32 ms | 80064 KB | Output is correct |
10 | Correct | 32 ms | 80212 KB | Output is correct |
11 | Correct | 32 ms | 80220 KB | Output is correct |
12 | Correct | 33 ms | 80212 KB | Output is correct |
13 | Correct | 34 ms | 80136 KB | Output is correct |
14 | Correct | 33 ms | 80248 KB | Output is correct |
15 | Correct | 33 ms | 80220 KB | Output is correct |
16 | Correct | 34 ms | 80212 KB | Output is correct |
17 | Correct | 35 ms | 80256 KB | Output is correct |
18 | Correct | 34 ms | 80216 KB | Output is correct |
19 | Correct | 34 ms | 80196 KB | Output is correct |
20 | Correct | 33 ms | 80220 KB | Output is correct |
21 | Correct | 33 ms | 80216 KB | Output is correct |
22 | Correct | 32 ms | 80220 KB | Output is correct |
23 | Correct | 34 ms | 80064 KB | Output is correct |
24 | Correct | 34 ms | 80216 KB | Output is correct |
25 | Correct | 34 ms | 80220 KB | Output is correct |
26 | Correct | 34 ms | 80212 KB | Output is correct |
27 | Correct | 44 ms | 80044 KB | Output is correct |
28 | Correct | 35 ms | 80208 KB | Output is correct |
29 | Correct | 33 ms | 80208 KB | Output is correct |
30 | Correct | 41 ms | 80180 KB | Output is correct |
31 | Correct | 35 ms | 80212 KB | Output is correct |
32 | Correct | 35 ms | 80212 KB | Output is correct |
33 | Correct | 35 ms | 80096 KB | Output is correct |
34 | Correct | 34 ms | 80208 KB | Output is correct |
35 | Correct | 35 ms | 80212 KB | Output is correct |
36 | Correct | 35 ms | 80212 KB | Output is correct |
37 | Correct | 33 ms | 80212 KB | Output is correct |
38 | Correct | 34 ms | 80216 KB | Output is correct |
39 | Correct | 35 ms | 80212 KB | Output is correct |
40 | Correct | 34 ms | 80216 KB | Output is correct |
41 | Correct | 35 ms | 80220 KB | Output is correct |
42 | Correct | 33 ms | 80188 KB | Output is correct |
43 | Correct | 35 ms | 80208 KB | Output is correct |
44 | Correct | 36 ms | 80116 KB | Output is correct |
45 | Correct | 33 ms | 80084 KB | Output is correct |
46 | Correct | 41 ms | 80212 KB | Output is correct |
47 | Correct | 31 ms | 80072 KB | Output is correct |
48 | Correct | 33 ms | 80288 KB | Output is correct |
49 | Correct | 33 ms | 80212 KB | Output is correct |
50 | Correct | 38 ms | 80068 KB | Output is correct |
51 | Correct | 35 ms | 80212 KB | Output is correct |
52 | Correct | 38 ms | 80256 KB | Output is correct |
53 | Correct | 37 ms | 80212 KB | Output is correct |
54 | Correct | 35 ms | 80208 KB | Output is correct |
55 | Correct | 36 ms | 80120 KB | Output is correct |
56 | Correct | 44 ms | 80220 KB | Output is correct |
57 | Correct | 36 ms | 80208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 80160 KB | Output is correct |
2 | Correct | 34 ms | 80220 KB | Output is correct |
3 | Correct | 35 ms | 80208 KB | Output is correct |
4 | Correct | 34 ms | 80220 KB | Output is correct |
5 | Correct | 31 ms | 80220 KB | Output is correct |
6 | Correct | 33 ms | 80212 KB | Output is correct |
7 | Correct | 30 ms | 80124 KB | Output is correct |
8 | Correct | 33 ms | 80208 KB | Output is correct |
9 | Correct | 32 ms | 80064 KB | Output is correct |
10 | Correct | 32 ms | 80212 KB | Output is correct |
11 | Correct | 32 ms | 80220 KB | Output is correct |
12 | Correct | 33 ms | 80212 KB | Output is correct |
13 | Correct | 34 ms | 80136 KB | Output is correct |
14 | Correct | 33 ms | 80248 KB | Output is correct |
15 | Correct | 33 ms | 80220 KB | Output is correct |
16 | Correct | 34 ms | 80212 KB | Output is correct |
17 | Correct | 35 ms | 80256 KB | Output is correct |
18 | Correct | 34 ms | 80216 KB | Output is correct |
19 | Correct | 34 ms | 80196 KB | Output is correct |
20 | Correct | 33 ms | 80220 KB | Output is correct |
21 | Correct | 33 ms | 80216 KB | Output is correct |
22 | Correct | 32 ms | 80220 KB | Output is correct |
23 | Correct | 34 ms | 80064 KB | Output is correct |
24 | Correct | 34 ms | 80216 KB | Output is correct |
25 | Correct | 34 ms | 80220 KB | Output is correct |
26 | Correct | 34 ms | 80212 KB | Output is correct |
27 | Correct | 44 ms | 80044 KB | Output is correct |
28 | Correct | 35 ms | 80208 KB | Output is correct |
29 | Correct | 33 ms | 80208 KB | Output is correct |
30 | Correct | 41 ms | 80180 KB | Output is correct |
31 | Correct | 35 ms | 80212 KB | Output is correct |
32 | Correct | 35 ms | 80212 KB | Output is correct |
33 | Correct | 35 ms | 80096 KB | Output is correct |
34 | Correct | 34 ms | 80208 KB | Output is correct |
35 | Correct | 35 ms | 80212 KB | Output is correct |
36 | Correct | 35 ms | 80212 KB | Output is correct |
37 | Correct | 33 ms | 80212 KB | Output is correct |
38 | Correct | 34 ms | 80216 KB | Output is correct |
39 | Correct | 35 ms | 80212 KB | Output is correct |
40 | Correct | 34 ms | 80216 KB | Output is correct |
41 | Correct | 35 ms | 80220 KB | Output is correct |
42 | Correct | 33 ms | 80188 KB | Output is correct |
43 | Correct | 35 ms | 80208 KB | Output is correct |
44 | Correct | 36 ms | 80116 KB | Output is correct |
45 | Correct | 33 ms | 80084 KB | Output is correct |
46 | Correct | 41 ms | 80212 KB | Output is correct |
47 | Correct | 31 ms | 80072 KB | Output is correct |
48 | Correct | 33 ms | 80288 KB | Output is correct |
49 | Correct | 33 ms | 80212 KB | Output is correct |
50 | Correct | 38 ms | 80068 KB | Output is correct |
51 | Correct | 35 ms | 80212 KB | Output is correct |
52 | Correct | 38 ms | 80256 KB | Output is correct |
53 | Correct | 37 ms | 80212 KB | Output is correct |
54 | Correct | 35 ms | 80208 KB | Output is correct |
55 | Correct | 36 ms | 80120 KB | Output is correct |
56 | Correct | 44 ms | 80220 KB | Output is correct |
57 | Correct | 36 ms | 80208 KB | Output is correct |
58 | Execution timed out | 1089 ms | 80340 KB | Time limit exceeded |
59 | Halted | 0 ms | 0 KB | - |