結果
問題 | No.2387 Yokan Factory |
ユーザー |
![]() |
提出日時 | 2023-07-21 22:45:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 971 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,056 KB |
実行使用メモリ | 251,668 KB |
最終ジャッジ日時 | 2024-09-22 00:17:06 |
合計ジャッジ時間 | 27,207 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 1 |
ソースコード
import heapqdef daiku(s,num):hq=[]heapq.heappush(hq,[0,s])high=[10**14+1 for _ in range(N)]use=[False for _ in range(N)]while len(hq)!=0:h,p=heapq.heappop(hq)if not use[p]:use[p]=Truefor e,c,m in edge[p]:if m>=num and high[e]>h+c:high[e]=h+cheapq.heappush(hq,[h+c,e])return high[-1]def nibun():left,right=-1,len(use)-1while right-left>1:mid=(right+left)//2dist=daiku(0,use[mid])if dist!=-1 and dist<=X:left=midelse:right=midif left==-1:return leftreturn use[left]import sysinput=sys.stdin.readlineN,M,X=map(int,input().split())edge=[[] for _ in range(N)]use=set()for _ in range(M):u,v,a,b=map(int,input().split())use.add(b)edge[u-1].append([v-1,a,b])edge[v-1].append([u-1,a,b])use=list(use)use.sort()print(nibun())