結果
問題 | No.2387 Yokan Factory |
ユーザー |
![]() |
提出日時 | 2023-07-21 22:05:26 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 880 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 82,564 KB |
実行使用メモリ | 266,852 KB |
最終ジャッジ日時 | 2024-09-21 23:37:27 |
合計ジャッジ時間 | 46,988 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 TLE * 2 |
ソースコード
import heapqdef daiku(s,num):hq=[]heapq.heappush(hq,[0,s])high=[-1 for _ in range(N)]karidist=[10**18+1 for _ in range(N)]while len(hq)!=0:h,p=heapq.heappop(hq)if high[p]==-1:high[p]=hfor e,c,m in edge[p]:if m>=num and karidist[e]>h+c:karidist[e]=h+cheapq.heappush(hq,[h+c,e])return high[-1]def nibun():left,right=-1,10**9+1while right-left>1:mid=(right+left)//2dist=daiku(0,mid)if dist!=-1 and dist<=X:left=midelse:right=midreturn leftimport sysinput=sys.stdin.readlineN,M,X=map(int,input().split())edge=[[] for _ in range(N)]for _ in range(M):u,v,a,b=map(int,input().split())edge[u-1].append([v-1,a,b])edge[v-1].append([u-1,a,b])print(nibun())