結果

問題 No.1 道のショートカット
ユーザー irisAsh
提出日時 2019-05-19 00:15:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-08 05:10:33
合計ジャッジ時間 2,829 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 WA * 24
権限があれば一括ダウンロードができます

ソースコード

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()))
d=[[None]*(c+1) for i in range(n)]
d[0][0] = 0
for i in range(v):
    for j in range(c+1):
        a=d[s[i]-1][j]
        if a is not None:
            q=y[i]+a
            if c < q:
                break
            p=t[i]-1
            x=a+m[i]
            if d[p][q] is None or x < d[p][q]:
                d[p][q] = x
o=None
for x in d[n-1]:
    if x is not None:
        if o is None or x < o:
            o=x
print(-1 if o is None else o)
0