# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
481407 | rainboy | Holding (COCI20_holding) | C11 | 49 ms | 4172 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 100
#define K 10000
#define INF 0x3f3f3f3f
int abs_(int a) { return a > 0 ? a : -a; }
int min(int a, int b) { return a < b ? a : b; }
int main() {
static int aa[N], dp[N + 1][K + 1];
int n, l, r, k, i, c, s, ans;
scanf("%d%d%d%d", &n, &l, &r, &k), l--, r--;
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
for (c = 0; c <= n; c++)
memset(dp[c], 0x3f, (k + 1) * sizeof *dp[c]);
dp[0][0] = 0;
for (i = 0; i < n; i++) {
for (c = r - l; c >= 0; c--) {
int d = abs_(i - (l + c));
for (s = 0; s + d <= k; s++)
dp[c + 1][s + d] = min(dp[c + 1][s + d], dp[c][s] + aa[i]);
}
}
c = r - l + 1;
ans = INF;
for (s = 0; s <= k; s++)
ans = min(ans, dp[c][s]);
printf("%d\n", ans);
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |