| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 866599 | maks007 | Stove (JOI18_stove) | C++14 | 1033 ms | 23896 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define int long long
signed main () {
int n, k;
cin >> n >> k;
vector <int> a(n + 1);
for(int i = 1; i <= n; i ++) cin >> a[i];
vector <vector <int> > dp(n + 1, vector <int> (k + 1, 1e9));
dp[0][0] = 0;
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= k; j ++) {
// dp[i][j] = min({dp[i][j], dp[i][j-1]});
for(int I = 0; I < i; I ++)
dp[i][j] = min(dp[I][j-1]+(a[i]-a[I+1]+1), dp[i][j]);
}
}
cout << dp[n][k];
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
