結果
| 問題 | No.2387 Yokan Factory |
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2025-02-06 18:21:19 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,586 ms / 5,000 ms |
| コード長 | 519 bytes |
| 記録 | |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 179,796 KB |
| 最終ジャッジ日時 | 2026-06-27 09:42:10 |
| 合計ジャッジ時間 | 17,257 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
n,m,X=map(int,input().split())
e=[[] for i in range(n)]
for i in range(m):
u,v,a,b=map(int,input().split())
u-=1
v-=1
e[u]+=[(v,a,b)]
e[v]+=[(u,a,b)]
from heapq import heappush,heappop
ok=-1
ng=10**10
while ng-ok>1:
m=(ok+ng)//2
v=[X+1]*n
v[0]=0
q=[(0,0)]
while len(q)>0:
sc,sp=heappop(q)
if sc!=v[sp]:
continue
for tp,tc,tw in e[sp]:
if tw>=m:
if v[tp]>sc+tc:
v[tp]=sc+tc
heappush(q,(v[tp],tp))
if v[n-1]<=X:
ok=m
else:
ng=m
print(ok)
sasa8uyauya