| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 924254 | rainboy | 리조트 (KOI16_resort) | C11 | 1 ms | 500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 100
#define C1 10000
#define C3 25000
#define C5 37000
#define INF 0x3f3f3f3f
int min(int a, int b) { return a < b ? a : b; }
int main() {
static char banned[N];
static int dp[N + 1][N + 1];
int n, m, i, j, c, x, ans;
scanf("%d%d", &n, &m);
while (m--) {
scanf("%d", &i), i--;
banned[i] = 1;
}
for (i = 0; i <= n; i++)
memset(dp[i], 0x3f, (n + 1) * sizeof *dp[i]);
dp[0][0] = 0;
for (i = 0; i < n; i++)
for (c = 0; c <= n; c++) {
x = dp[i][c];
if (x == INF)
continue;
if (banned[i])
dp[i + 1][c] = min(dp[i + 1][c], x);
else {
if (c < 3)
dp[i + 1][c] = min(dp[i + 1][c], x + C1);
else
dp[i + 1][c - 3] = min(dp[i + 1][c - 3], x);
j = min(i + 3, n);
dp[j][c + 1] = min(dp[j][c + 1], x + C3);
j = min(i + 5, n);
dp[j][c + 2] = min(dp[j][c + 2], x + C5);
}
}
ans = INF;
for (c = 0; c <= n; c++)
ans = min(ans, dp[n][c]);
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... | ||||
