結果

問題 No.1 道のショートカット
ユーザー miztommiztom
提出日時 2024-03-12 13:09:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 359 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 64,196 KB
最終ジャッジ日時 2024-03-12 13:09:34
合計ジャッジ時間 4,659 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,332 KB
testcase_01 AC 36 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 36 ms
53,332 KB
testcase_04 AC 35 ms
53,332 KB
testcase_05 AC 36 ms
53,332 KB
testcase_06 AC 36 ms
53,332 KB
testcase_07 AC 39 ms
53,332 KB
testcase_08 AC 50 ms
64,196 KB
testcase_09 AC 46 ms
61,828 KB
testcase_10 AC 45 ms
61,828 KB
testcase_11 AC 49 ms
64,196 KB
testcase_12 AC 52 ms
64,180 KB
testcase_13 AC 53 ms
64,180 KB
testcase_14 AC 41 ms
59,456 KB
testcase_15 AC 36 ms
53,332 KB
testcase_16 AC 53 ms
61,852 KB
testcase_17 AC 37 ms
53,332 KB
testcase_18 AC 41 ms
59,456 KB
testcase_19 AC 41 ms
59,456 KB
testcase_20 AC 43 ms
59,712 KB
testcase_21 AC 43 ms
59,456 KB
testcase_22 AC 40 ms
59,456 KB
testcase_23 AC 50 ms
64,180 KB
testcase_24 AC 52 ms
64,196 KB
testcase_25 AC 48 ms
61,856 KB
testcase_26 AC 43 ms
59,456 KB
testcase_27 AC 50 ms
62,092 KB
testcase_28 AC 40 ms
59,468 KB
testcase_29 AC 49 ms
64,180 KB
testcase_30 AC 45 ms
61,988 KB
testcase_31 AC 47 ms
61,972 KB
testcase_32 AC 48 ms
61,828 KB
testcase_33 AC 47 ms
61,836 KB
testcase_34 AC 51 ms
64,196 KB
testcase_35 AC 45 ms
61,832 KB
testcase_36 AC 46 ms
61,828 KB
testcase_37 AC 45 ms
61,828 KB
testcase_38 AC 41 ms
59,456 KB
testcase_39 AC 42 ms
59,456 KB
testcase_40 AC 44 ms
59,712 KB
testcase_41 AC 41 ms
59,456 KB
testcase_42 AC 37 ms
53,332 KB
testcase_43 AC 36 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
c=int(input())
v=int(input())
f=lambda:map(int,input().split())
g=[[]for i in range(n)]
for s,t,y,m in zip(f(),f(),f(),f()):g[t-1].append((s-1,y,m))
dp=[-~c*[1<<20]for i in range(n)]
dp[0][0]=0
for i in range(n):
    for j,k,l in g[i]:
        for m in range(k,c+1):dp[i][m]=min(dp[i][m],dp[j][m-k]+l)
r=min(dp[-1])
print(r if r<1<<20 else -1)
0