結果

問題 No.2805 Go to School
ユーザー hirayuu_ychirayuu_yc
提出日時 2024-07-04 09:35:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 153,164 KB
最終ジャッジ日時 2024-07-04 21:14:56
合計ジャッジ時間 17,714 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
52,480 KB
testcase_02 AC 40 ms
52,480 KB
testcase_03 AC 41 ms
52,608 KB
testcase_04 AC 601 ms
119,040 KB
testcase_05 AC 432 ms
98,892 KB
testcase_06 AC 340 ms
98,560 KB
testcase_07 AC 501 ms
122,496 KB
testcase_08 AC 390 ms
98,276 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 39 ms
52,352 KB
testcase_15 AC 38 ms
52,352 KB
testcase_16 WA -
testcase_17 AC 508 ms
108,164 KB
testcase_18 WA -
testcase_19 AC 728 ms
123,400 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 671 ms
119,556 KB
testcase_23 AC 655 ms
117,700 KB
testcase_24 AC 339 ms
98,304 KB
testcase_25 AC 856 ms
153,056 KB
testcase_26 AC 436 ms
133,376 KB
testcase_27 AC 103 ms
85,504 KB
testcase_28 AC 113 ms
86,400 KB
testcase_29 AC 223 ms
110,976 KB
testcase_30 AC 451 ms
104,828 KB
testcase_31 WA -
testcase_32 AC 848 ms
143,328 KB
testcase_33 AC 62 ms
65,152 KB
testcase_34 AC 67 ms
66,176 KB
testcase_35 WA -
testcase_36 AC 382 ms
103,424 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import*
N,M,L,S,E=map(int,input().split())
gr=[[] for i in range(N*2)]
edge=[]
for i in range(M):
    a,b,t=map(int,input().split())
    gr[(a-1)*2].append(((b-1)*2,t))
    gr[(b-1)*2].append(((a-1)*2,t))
    gr[(a-1)*2+1].append(((b-1)*2+1,t))
    gr[(b-1)*2+1].append(((a-1)*2+1,t))
T=list(map(int,input().split()))
for t in T:
    gr[(t-1)*2].append(((t-1)*2+1,-1))
dist=[1<<60]*N*2
dist[0]=0
vert=[(0,0)]
while vert:
    dis,pos=heappop(vert)
    if dist[pos]!=dis:
        continue
    for t,c in gr[pos]:
        nxt=dis+c
        if c==-1:
            nxt=max(S,dis)+1
        if dist[t]>nxt:
            dist[t]=nxt
            heappush(vert,(nxt,t))
if dist[-1]>=1<<60:
    print(-1)
else:
    print(dist[-1])
0