| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 704724 | rainboy | 오렌지 출하 (JOI16_ho_t1) | C11 | 49 ms | 712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 20000
#define INF 0x3f3f3f3f3f3f3f3fLL
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
int main() {
static int aa[N];
static long long dp[N + 1];
int n, m, c, i, j;
long long mn, mx;
scanf("%d%d%d", &n, &m, &c);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
memset(dp, 0x3f, (n + 1) * sizeof *dp), dp[0] = 0;
for (i = 0; i < n; i++) {
mn = INF, mx = 0;
for (j = i + 1; j <= n && j - i <= m; j++) {
mn = min(mn, aa[j - 1]), mx = max(mx, aa[j - 1]);
dp[j] = min(dp[j], dp[i] + (mx - mn) * (j - i) + c);
}
}
printf("%lld\n", dp[n]);
return 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... | ||||
