| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1241892 | khanhtt | Stove (JOI18_stove) | C++20 | 1099 ms | 98504 KiB |
#include <iostream>
#include <cstring>
using namespace std;
int n,k,A[100005];
int f[5005][5005];
int dp(int i, int l){
if (l>k) return 1e9+5;
if (i>n) return 0;
if (f[i][l]!=-1) return f[i][l];
f[i][l]=1e9+5;
for (int j=i; j<=n; j++){
f[i][l]=min(f[i][l],dp(j+1, l+1)+(A[j]-A[i]+1));
}
return f[i][l];
}
main(){
ios::sync_with_stdio(0);
cin.tie(nullptr);
memset(f,-1,sizeof(f));
cin >> n >> k;
for (int i=1; i<=n; i++) cin >> A[i];
cout << dp(1,0);
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
