답안 #1043201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1043201 2024-08-04T04:49:53 Z 0pt1mus23 K개의 묶음 (IZhO14_blocks) C++14
53 / 100
1000 ms 40032 KB
#pragma GCC optimize("O3", "inline")

#include <bits/stdc++.h> 
using namespace std; 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define ins insert
#define pb push_back
// #define int long long int
#define pii pair<int, int>
#define endl '\n' 
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()
#define hash z0hashp
#define div  z0dvp
const int mod = 1e9 +7, sze = 1e5 +23, inf = INT_MAX, P = 1453;
int dp[sze][101];

int arr[sze];

void opt1z(){
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>arr[i];

    }
    memset(dp,0x3f,sizeof dp);
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        for(int  j=1;j<=k;j++){
            int mx = arr[i];
            for(int ip=i-1;ip>=0;ip--){
                dp[i][j]=min(dp[i][j],dp[ip][j-1] + mx);
                // cout<<i<<" "<<j<<" "<<ip<<" "<<mx<<endl;
                mx=max(mx,arr[ip]);
            }

        }
    }

    drop(dp[n][k]);
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int tt = 1;
    // cin>>tt;
    while(tt--){
        opt1z();
    }
 
    return 0;
} 
 
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 39772 KB Output is correct
2 Correct 12 ms 39868 KB Output is correct
3 Correct 12 ms 39772 KB Output is correct
4 Correct 12 ms 39976 KB Output is correct
5 Correct 16 ms 39772 KB Output is correct
6 Correct 15 ms 39772 KB Output is correct
7 Correct 22 ms 39768 KB Output is correct
8 Correct 16 ms 39904 KB Output is correct
9 Correct 14 ms 39836 KB Output is correct
10 Correct 15 ms 39772 KB Output is correct
11 Correct 14 ms 39840 KB Output is correct
12 Correct 20 ms 39772 KB Output is correct
13 Correct 21 ms 39836 KB Output is correct
14 Correct 15 ms 39768 KB Output is correct
15 Correct 17 ms 39768 KB Output is correct
16 Correct 20 ms 39772 KB Output is correct
17 Correct 14 ms 39772 KB Output is correct
18 Correct 14 ms 39772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 39772 KB Output is correct
2 Correct 16 ms 39948 KB Output is correct
3 Correct 13 ms 39772 KB Output is correct
4 Correct 13 ms 39772 KB Output is correct
5 Correct 12 ms 39768 KB Output is correct
6 Correct 13 ms 39904 KB Output is correct
7 Correct 19 ms 39764 KB Output is correct
8 Correct 15 ms 39904 KB Output is correct
9 Correct 15 ms 39772 KB Output is correct
10 Correct 14 ms 39768 KB Output is correct
11 Correct 17 ms 39768 KB Output is correct
12 Correct 19 ms 39772 KB Output is correct
13 Correct 14 ms 39876 KB Output is correct
14 Correct 13 ms 39756 KB Output is correct
15 Correct 13 ms 39772 KB Output is correct
16 Correct 13 ms 39980 KB Output is correct
17 Correct 14 ms 39772 KB Output is correct
18 Correct 13 ms 39768 KB Output is correct
19 Correct 13 ms 39772 KB Output is correct
20 Correct 15 ms 39992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 39772 KB Output is correct
2 Correct 12 ms 39868 KB Output is correct
3 Correct 12 ms 39772 KB Output is correct
4 Correct 12 ms 39976 KB Output is correct
5 Correct 16 ms 39772 KB Output is correct
6 Correct 15 ms 39772 KB Output is correct
7 Correct 22 ms 39768 KB Output is correct
8 Correct 16 ms 39904 KB Output is correct
9 Correct 14 ms 39836 KB Output is correct
10 Correct 15 ms 39772 KB Output is correct
11 Correct 14 ms 39840 KB Output is correct
12 Correct 20 ms 39772 KB Output is correct
13 Correct 21 ms 39836 KB Output is correct
14 Correct 15 ms 39768 KB Output is correct
15 Correct 17 ms 39768 KB Output is correct
16 Correct 20 ms 39772 KB Output is correct
17 Correct 14 ms 39772 KB Output is correct
18 Correct 14 ms 39772 KB Output is correct
19 Correct 17 ms 39772 KB Output is correct
20 Correct 16 ms 39948 KB Output is correct
21 Correct 13 ms 39772 KB Output is correct
22 Correct 13 ms 39772 KB Output is correct
23 Correct 12 ms 39768 KB Output is correct
24 Correct 13 ms 39904 KB Output is correct
25 Correct 19 ms 39764 KB Output is correct
26 Correct 15 ms 39904 KB Output is correct
27 Correct 15 ms 39772 KB Output is correct
28 Correct 14 ms 39768 KB Output is correct
29 Correct 17 ms 39768 KB Output is correct
30 Correct 19 ms 39772 KB Output is correct
31 Correct 14 ms 39876 KB Output is correct
32 Correct 13 ms 39756 KB Output is correct
33 Correct 13 ms 39772 KB Output is correct
34 Correct 13 ms 39980 KB Output is correct
35 Correct 14 ms 39772 KB Output is correct
36 Correct 13 ms 39768 KB Output is correct
37 Correct 13 ms 39772 KB Output is correct
38 Correct 15 ms 39992 KB Output is correct
39 Correct 13 ms 39932 KB Output is correct
40 Correct 12 ms 39768 KB Output is correct
41 Correct 15 ms 39772 KB Output is correct
42 Correct 12 ms 39772 KB Output is correct
43 Correct 13 ms 39936 KB Output is correct
44 Correct 11 ms 39872 KB Output is correct
45 Correct 12 ms 39772 KB Output is correct
46 Correct 13 ms 39772 KB Output is correct
47 Correct 13 ms 39896 KB Output is correct
48 Correct 13 ms 39768 KB Output is correct
49 Correct 19 ms 39768 KB Output is correct
50 Correct 14 ms 39768 KB Output is correct
51 Correct 14 ms 39772 KB Output is correct
52 Correct 12 ms 39772 KB Output is correct
53 Correct 22 ms 39972 KB Output is correct
54 Correct 22 ms 39772 KB Output is correct
55 Correct 20 ms 39772 KB Output is correct
56 Correct 20 ms 39768 KB Output is correct
57 Correct 17 ms 39768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 39772 KB Output is correct
2 Correct 12 ms 39868 KB Output is correct
3 Correct 12 ms 39772 KB Output is correct
4 Correct 12 ms 39976 KB Output is correct
5 Correct 16 ms 39772 KB Output is correct
6 Correct 15 ms 39772 KB Output is correct
7 Correct 22 ms 39768 KB Output is correct
8 Correct 16 ms 39904 KB Output is correct
9 Correct 14 ms 39836 KB Output is correct
10 Correct 15 ms 39772 KB Output is correct
11 Correct 14 ms 39840 KB Output is correct
12 Correct 20 ms 39772 KB Output is correct
13 Correct 21 ms 39836 KB Output is correct
14 Correct 15 ms 39768 KB Output is correct
15 Correct 17 ms 39768 KB Output is correct
16 Correct 20 ms 39772 KB Output is correct
17 Correct 14 ms 39772 KB Output is correct
18 Correct 14 ms 39772 KB Output is correct
19 Correct 17 ms 39772 KB Output is correct
20 Correct 16 ms 39948 KB Output is correct
21 Correct 13 ms 39772 KB Output is correct
22 Correct 13 ms 39772 KB Output is correct
23 Correct 12 ms 39768 KB Output is correct
24 Correct 13 ms 39904 KB Output is correct
25 Correct 19 ms 39764 KB Output is correct
26 Correct 15 ms 39904 KB Output is correct
27 Correct 15 ms 39772 KB Output is correct
28 Correct 14 ms 39768 KB Output is correct
29 Correct 17 ms 39768 KB Output is correct
30 Correct 19 ms 39772 KB Output is correct
31 Correct 14 ms 39876 KB Output is correct
32 Correct 13 ms 39756 KB Output is correct
33 Correct 13 ms 39772 KB Output is correct
34 Correct 13 ms 39980 KB Output is correct
35 Correct 14 ms 39772 KB Output is correct
36 Correct 13 ms 39768 KB Output is correct
37 Correct 13 ms 39772 KB Output is correct
38 Correct 15 ms 39992 KB Output is correct
39 Correct 13 ms 39932 KB Output is correct
40 Correct 12 ms 39768 KB Output is correct
41 Correct 15 ms 39772 KB Output is correct
42 Correct 12 ms 39772 KB Output is correct
43 Correct 13 ms 39936 KB Output is correct
44 Correct 11 ms 39872 KB Output is correct
45 Correct 12 ms 39772 KB Output is correct
46 Correct 13 ms 39772 KB Output is correct
47 Correct 13 ms 39896 KB Output is correct
48 Correct 13 ms 39768 KB Output is correct
49 Correct 19 ms 39768 KB Output is correct
50 Correct 14 ms 39768 KB Output is correct
51 Correct 14 ms 39772 KB Output is correct
52 Correct 12 ms 39772 KB Output is correct
53 Correct 22 ms 39972 KB Output is correct
54 Correct 22 ms 39772 KB Output is correct
55 Correct 20 ms 39772 KB Output is correct
56 Correct 20 ms 39768 KB Output is correct
57 Correct 17 ms 39768 KB Output is correct
58 Execution timed out 1040 ms 40032 KB Time limit exceeded
59 Halted 0 ms 0 KB -