結果

問題 No.1 道のショートカット
ユーザー rarpipipirarpipipi
提出日時 2023-12-31 03:31:19
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 633 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 848,360 KB
最終ジャッジ日時 2023-12-31 03:31:27
合計ジャッジ時間 5,106 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,484 KB
testcase_01 AC 40 ms
55,484 KB
testcase_02 AC 41 ms
55,484 KB
testcase_03 AC 40 ms
55,484 KB
testcase_04 AC 50 ms
55,484 KB
testcase_05 AC 40 ms
55,484 KB
testcase_06 AC 41 ms
55,484 KB
testcase_07 AC 41 ms
55,484 KB
testcase_08 AC 59 ms
68,624 KB
testcase_09 AC 52 ms
64,292 KB
testcase_10 AC 60 ms
68,564 KB
testcase_11 MLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

INF=float('inf')
n=int(input())
c=int(input())
v=int(input())

from collections import defaultdict
edge=defaultdict(list)

s=list(map(lambda x:int(x)-1,input().split()))
t=list(map(lambda x:int(x)-1,input().split()))
y=list(map(int,input().split()))
m=list(map(int,input().split()))
for i in range(v):
    si,ti,yi,mi=s[i],t[i],y[i],m[i]
    edge[si].append((ti,yi,mi))

dp=[[] for i in range(n)]
dp[0]=[(0,0)]
for ci in range(n):
    for cy,cm in dp[ci]:
        for ni,ny,nm in edge[ci]:
            if cy+ny<=c:
                dp[ni].append((cy+ny,cm+nm))

if dp[-1]:
    print(min([mm for yy,mm in dp[-1]]))
else:
    print(-1)
0