Model the city as a graph and find the shortest route and distance from the shop to any customer.
Skills: C++ / Java / Python, graphs, Dijkstra's algorithm
Every local delivery shop plans routes in the owner's head
A local grocery shop delivers to customers across the city on a bike. The delivery boy is new and wastes time on long routes.
Model the city as a graph: important points (chowks, landmarks) are nodes and roads are edges with distance in km. Some roads are one-way.
Input format:
N M (points, roads)
name1 ... nameN
a b km one_way(0/1) (M lines)
source
destinationCreate a free student account to submit your work, get mentor feedback and unlock the reference solution.