# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42264 | RezwanArefin01 | Stove (JOI18_stove) | C++14 | 49 ms | 47724 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
int a[5001], n, K, dp[5001][5001];
int main(int argc, char const *argv[]) {
scanf("%d %d", &n, &K);
for(int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for(int i = 1; i <= n; i++)
dp[1][i] = a[i] - a[1] + 1;
for(int k = 2; k <= K; k++) {
int Min = 1e9;
for(int i = 1; i <= n; i++) {
dp[k][i] = a[i] + Min + 1;
if(i < n) Min = min(Min, dp[k - 1][i] - a[i + 1]);
}
}
cout << dp[K][n] << endl;
}
컴파일 시 표준 에러 (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... |