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