結果

問題 No.2387 Yokan Factory
ユーザー miho-4miho-4
提出日時 2023-07-22 00:09:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,417 ms / 5,000 ms
コード長 636 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 211,856 KB
最終ジャッジ日時 2023-10-22 00:04:52
合計ジャッジ時間 22,405 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,452 KB
testcase_01 AC 40 ms
53,452 KB
testcase_02 AC 41 ms
53,452 KB
testcase_03 AC 40 ms
53,452 KB
testcase_04 AC 39 ms
53,452 KB
testcase_05 AC 39 ms
53,452 KB
testcase_06 AC 40 ms
53,452 KB
testcase_07 AC 40 ms
53,452 KB
testcase_08 AC 39 ms
53,452 KB
testcase_09 AC 40 ms
53,452 KB
testcase_10 AC 39 ms
53,452 KB
testcase_11 AC 40 ms
53,452 KB
testcase_12 AC 39 ms
53,452 KB
testcase_13 AC 39 ms
53,452 KB
testcase_14 AC 39 ms
53,452 KB
testcase_15 AC 1,302 ms
159,248 KB
testcase_16 AC 634 ms
134,364 KB
testcase_17 AC 1,790 ms
211,856 KB
testcase_18 AC 2,183 ms
152,664 KB
testcase_19 AC 1,496 ms
130,624 KB
testcase_20 AC 930 ms
115,112 KB
testcase_21 AC 2,310 ms
159,644 KB
testcase_22 AC 852 ms
110,132 KB
testcase_23 AC 2,233 ms
143,092 KB
testcase_24 AC 721 ms
109,616 KB
testcase_25 AC 1,025 ms
114,588 KB
testcase_26 AC 2,417 ms
154,588 KB
testcase_27 AC 980 ms
136,448 KB
testcase_28 AC 98 ms
77,044 KB
testcase_29 AC 129 ms
77,796 KB
testcase_30 AC 123 ms
77,768 KB
testcase_31 AC 119 ms
76,336 KB
testcase_32 AC 99 ms
76,260 KB
testcase_33 AC 89 ms
76,204 KB
testcase_34 AC 160 ms
77,848 KB
testcase_35 AC 131 ms
77,760 KB
testcase_36 AC 65 ms
68,360 KB
testcase_37 AC 40 ms
53,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n,m,X=map(int,input().split())
edge=[tuple(map(int,input().split())) for _ in range(m)]

E=[[] for _ in range(n+1)]
for u,v,a,b in edge:
  E[u].append((v,a,b))
  E[v].append((u,a,b))
  
for i in range(n+1):
  E[i].sort(key=lambda x:x[2],reverse=True)

def f(w):
  D=[10**19]*(n+1)
  D[1]=0
  q=[(0,1)]
  while q:
    d,x=heapq.heappop(q)
    if x==n:break
    if D[x]<d:continue
    for e,a,b in E[x]:
      if b<w:break
      if D[x]+a<D[e]:
        D[e]=D[x]+a
        heapq.heappush(q,(d+a,e))

  return 0<D[-1]<=X

l,r=-1,10**9+10
while l+1<r:
  m=(l+r)//2
  flag=f(m)

  if flag:
    l=m
  else:
    r=m
    
print(l)
0