結果

問題 No.1 道のショートカット
ユーザー rarpipipirarpipipi
提出日時 2023-12-31 01:47:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 772 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 332,044 KB
最終ジャッジ日時 2023-12-31 01:47:46
合計ジャッジ時間 8,188 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,604 KB
testcase_01 AC 39 ms
55,604 KB
testcase_02 AC 40 ms
55,608 KB
testcase_03 AC 40 ms
55,604 KB
testcase_04 AC 39 ms
55,604 KB
testcase_05 AC 40 ms
55,604 KB
testcase_06 AC 39 ms
55,604 KB
testcase_07 AC 40 ms
55,604 KB
testcase_08 AC 107 ms
77,028 KB
testcase_09 AC 66 ms
70,820 KB
testcase_10 AC 141 ms
77,508 KB
testcase_11 TLE -
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 #

n=int(input())
c=int(input())
v=int(input())

from heapq import heapify,heappop,heappush
que=[]
se=set()
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))

heappush(que,(0,0,0))
INF=float('inf')
mi_y=[INF]*n
mi_y[0]=0
ans=INF

while que:
    cm,cy,ci=heappop(que)
    if ci==n-1:
        ans=min(cm,ans)

    for ni,ny,nm in edge[ci]:
        sm=cm+nm
        sy=cy+ny
        if sy>c:
            continue
        if mi_y[ni]<sy:
            continue
        heappush(que,(sm,sy,ni))
print(ans if ans!=INF else -1)
0