結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-19 03:23:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 5,000 ms |
| コード長 | 706 bytes |
| コンパイル時間 | 859 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 76,032 KB |
| 最終ジャッジ日時 | 2024-07-20 16:45:45 |
| 合計ジャッジ時間 | 4,547 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 40 |
ソースコード
#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
C = int(readline())
V = int(readline())
S = tuple(map(int, readline().split()))
T = tuple(map(int, readline().split()))
Y = tuple(map(int, readline().split()))
M = tuple(map(int, readline().split()))
INF = 10 ** 9
dp = [[INF] * (C + 1) for _ in range(N + 1)]
dp[1][0] = 0
for c in range(C):
for s, t, y, m in zip(S, T, Y, M):
c1 = c + y
if c1 > C:
continue
x = dp[s][c] + m
if dp[t][c1] > x:
dp[t][c1] = x
answer = min(dp[N])
if answer == INF:
answer = -1
print(answer)
maspy