結果

問題 No.1 道のショートカット
ユーザー matsu7874
提出日時 2015-12-07 21:36:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 364 ms / 5,000 ms
コード長 523 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-07-20 16:18:33
合計ジャッジ時間 5,159 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
C = int(input())
V = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
Y = list(map(int, input().split()))
M = list(map(int, input().split()))

Vec = [(S[i], T[i], Y[i], M[i]) for i in range(V)]
Vec.sort()

dp = [[50001 for j in range(601)] for i in range(51)]
dp[1][C] = 0
for v in Vec:
    for i in range(C + 1):
        dp[v[1]][i] = min(dp[v[1]][i], dp[v[0]][i + v[2]] + v[3])
min_minute = min(dp[N])
if min_minute == 50001:
    print(-1)
else:
    print(min_minute)
0