結果
問題 | No.2387 Yokan Factory |
ユーザー |
![]() |
提出日時 | 2023-07-21 21:55:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 810 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 265,788 KB |
最終ジャッジ日時 | 2024-09-21 23:26:11 |
合計ジャッジ時間 | 22,765 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 18 TLE * 1 |
ソースコード
import heapqdef daiku(s,num):hq=[]heapq.heappush(hq,[0,s])high=[-1 for _ in range(N)]karidist=[10**15 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 leftN,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])print(nibun())