結果

問題 No.2805 Go to School
ユーザー hirayuu_ychirayuu_yc
提出日時 2024-07-04 07:58:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 739 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 158,060 KB
最終ジャッジ日時 2024-07-04 21:14:23
合計ジャッジ時間 17,839 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
57,856 KB
testcase_01 AC 42 ms
52,464 KB
testcase_02 AC 42 ms
52,224 KB
testcase_03 AC 40 ms
52,608 KB
testcase_04 AC 661 ms
118,912 KB
testcase_05 AC 426 ms
98,892 KB
testcase_06 AC 376 ms
98,400 KB
testcase_07 AC 569 ms
121,996 KB
testcase_08 AC 412 ms
97,768 KB
testcase_09 AC 322 ms
101,120 KB
testcase_10 AC 864 ms
140,800 KB
testcase_11 AC 562 ms
113,980 KB
testcase_12 AC 772 ms
127,560 KB
testcase_13 AC 222 ms
88,960 KB
testcase_14 AC 40 ms
52,608 KB
testcase_15 AC 40 ms
52,608 KB
testcase_16 AC 41 ms
52,608 KB
testcase_17 AC 547 ms
107,400 KB
testcase_18 AC 414 ms
96,720 KB
testcase_19 AC 836 ms
122,508 KB
testcase_20 AC 985 ms
141,844 KB
testcase_21 AC 534 ms
106,448 KB
testcase_22 AC 713 ms
119,244 KB
testcase_23 AC 729 ms
116,608 KB
testcase_24 AC 362 ms
97,944 KB
testcase_25 AC 917 ms
153,064 KB
testcase_26 AC 475 ms
133,760 KB
testcase_27 AC 100 ms
85,504 KB
testcase_28 AC 121 ms
86,400 KB
testcase_29 AC 244 ms
111,232 KB
testcase_30 AC 493 ms
103,848 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

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)
    for t,c in gr[pos]:
        nxt=dis+c
        if c==-1:
            if dis>=S+E:
                continue
            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