結果
問題 | No.2387 Yokan Factory |
ユーザー |
![]() |
提出日時 | 2025-02-06 18:21:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,652 ms / 5,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 537 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 177,964 KB |
最終ジャッジ日時 | 2025-02-06 18:21:48 |
合計ジャッジ時間 | 22,954 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)