# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
173239 | songc | 오렌지 출하 (JOI16_ho_t1) | C++14 | 51 ms | 1016 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
int N, M;
LL K;
LL D[20202], A[20202];
int main(){
scanf("%d %d %lld", &N, &M, &K);
for (int i=1; i<=N; i++){
scanf("%lld", &A[i]);
D[i] = 1234567890123456ll;
LL Max=A[i], Min=A[i];
for (int j=1; j<=M && i-j>=0; j++){
Max = max(Max, A[i-j+1]);
Min = min(Min, A[i-j+1]);
D[i] = min(D[i], D[i-j]+K+j*(Max-Min));
}
}
printf("%lld\n", D[N]);
return 0;
}
Compilation message (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... |