結果
| 問題 |
No.2387 Yokan Factory
|
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2023-07-21 21:41:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,800 ms / 5,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 188,024 KB |
| 最終ジャッジ日時 | 2024-09-21 23:07:02 |
| 合計ジャッジ時間 | 24,557 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
from heapq import heappop,heappush
n,m,x = map(int,input().split())
adj = [[] for _ in range(n)]
for _ in range(m):
u,v,a,b = map(int,input().split())
adj[u-1].append((v-1,a,b))
adj[v-1].append((u-1,a,b))
ok = -1; ng = 10**9+1
while ng-ok>1:
mid = (ok+ng)//2
t = [0]+[10**18+1]*(n-1); f = [False]*n; hq = [(0,0)]
while hq:
d,p = heappop(hq)
if f[p]: continue
f[p] = True
for c,a,b in adj[p]:
if b>=mid and t[c]>d+a: t[c] = d+a; heappush(hq,(t[c],c))
if t[n-1]<=x: ok = mid
else: ng = mid
print(ok)
ニックネーム