結果

問題 No.1 道のショートカット
コンテスト
ユーザー irisAsh
提出日時 2019-05-19 01:35:52
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 160 ms / 5,000 ms
+ 656µs
コード長 648 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 70 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2026-10-13 10:56:12
合計ジャッジ時間 4,541 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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()))
z=zip(S,T,Y,M)
d=[[None]*(c+1) for i in range(n)]
d[0][0] = 0
for s,t,y,m in sorted(z,key=lambda x:(x[0],x[1])):
    for j in range(c+1):
        a=d[s-1][j]
        if a is not None:
            q=y+j
            if c<q:
                break
            p=t-1
            x=a+m
            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