結果

問題 No.2387 Yokan Factory
ユーザー sepa38sepa38
提出日時 2023-07-21 21:45:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,797 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,748 KB
実行使用メモリ 128,104 KB
最終ジャッジ日時 2023-10-21 21:44:35
合計ジャッジ時間 16,239 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,448 KB
testcase_01 AC 39 ms
53,448 KB
testcase_02 AC 39 ms
53,448 KB
testcase_03 AC 42 ms
53,448 KB
testcase_04 AC 39 ms
53,448 KB
testcase_05 AC 40 ms
53,448 KB
testcase_06 AC 39 ms
53,448 KB
testcase_07 AC 42 ms
53,448 KB
testcase_08 AC 41 ms
53,448 KB
testcase_09 AC 43 ms
53,448 KB
testcase_10 AC 40 ms
53,448 KB
testcase_11 AC 39 ms
53,448 KB
testcase_12 AC 42 ms
53,448 KB
testcase_13 AC 42 ms
53,448 KB
testcase_14 AC 41 ms
53,448 KB
testcase_15 AC 883 ms
113,328 KB
testcase_16 AC 493 ms
110,264 KB
testcase_17 AC 1,379 ms
128,104 KB
testcase_18 AC 1,278 ms
109,148 KB
testcase_19 AC 1,006 ms
99,932 KB
testcase_20 AC 542 ms
93,824 KB
testcase_21 AC 1,709 ms
114,112 KB
testcase_22 AC 616 ms
93,224 KB
testcase_23 AC 1,797 ms
103,144 KB
testcase_24 AC 711 ms
93,928 KB
testcase_25 AC 751 ms
91,780 KB
testcase_26 AC 1,023 ms
105,376 KB
testcase_27 AC 620 ms
104,168 KB
testcase_28 AC 79 ms
73,724 KB
testcase_29 AC 96 ms
76,676 KB
testcase_30 AC 125 ms
77,192 KB
testcase_31 AC 115 ms
76,108 KB
testcase_32 AC 99 ms
76,140 KB
testcase_33 AC 95 ms
75,948 KB
testcase_34 AC 129 ms
77,252 KB
testcase_35 AC 117 ms
76,512 KB
testcase_36 AC 55 ms
64,120 KB
testcase_37 AC 41 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n, m, x = map(int, input().split())
e = [[] for _ in range(n)]
for _ in range(m):
  u, v, a, b = map(int, input().split())
  u -= 1
  v -= 1
  e[u].append([v, a, b])
  e[v].append([u, a, b])
l, r = -1, 1 << 30
while r - l > 1:
  piv = (l + r) // 2
  dist = [1 << 60] * n
  dist[0] = 0
  h = [0]
  while h:
    tmp = heapq.heappop(h)
    d, u = divmod(tmp, n)
    if d > x:
      break
    if u == n:
      break
    if dist[u] < d:
      continue
    for v, a, b in e[u]:
      if b < piv:
        continue
      if d + a < dist[v]:
        dist[v] = d + a
        heapq.heappush(h, dist[v]*n+v)
  if dist[-1] <= x:
    l = piv
  else:
    r = piv
print(l)
0