Bakery
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.
To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numbered a1, a2, ..., ak.
Unforunately the law of the country Masha lives in prohibits opening bakery in any of the cities which has storage located in it. She can open it only in one of another n - k cities, and, of course, flour delivery should be paid — for every kilometer of path between storage and bakery Masha should pay 1 ruble.
Formally, Masha will pay

马莎想要在某国的n个城市之一开设烘焙店,并从k个面粉仓库中选择一个供应面粉。法律规定,烘焙店不能开设在仓库所在城市。马莎需要找到一个城市,使得从仓库到烘焙店的最短路径成本最低。输入包含城市数量、道路信息和仓库位置,输出最低配送成本。如果无法满足条件,则输出-1。
最低0.47元/天 解锁文章
&spm=1001.2101.3001.5002&articleId=98213445&d=1&t=3&u=c7dd848750ba41a78d3db1e93f5f99cd)
308

被折叠的 条评论
为什么被折叠?



