| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 831984 | konber | Stove (JOI18_stove) | C++14 | 155 ms | 198348 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
typedef long long ll;
vector<ll> times;
ll memo[5005][5005];
int N;
ll dp(int i, int remK){
    if(remK < 0) return 1e15;
    if(i==N) return 0;
    if(memo[i][remK] != -1) return memo[i][remK];
    ll ch1=1e15;
    if(i){
        ch1 = dp(i+1, remK) + times[i]+1 - times[i-1]-1;
    }
    ll ch2 = dp(i+1, remK-1) + 1;
    return memo[i][remK] = min(ch1, ch2);
}
int main()
{
    int K;
    scanf("%d%d", &N, &K);
    times.resize(N);
    for(int i=0; i < N; i++)
        scanf("%lld", ×[i]);
    memset(memo, -1, sizeof memo);
    cout << dp(0, K) << 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... | ||||
