A group of friends is traveling to a Campground using two cars for carpooling. The two drivers depart simultaneously from different starting locations and follow the road network, which has the following properties:
[from, to, duration], where from and to are location names, and duration is the travel time in minutes along that segment.Friends are waiting at their homes along the routes. Each friend is described by [name, home], where name is the person's name and home is the location where they wait.
Pickup Rules:
Given roads, starts, and people, return a list of two sublists:
i-th sublist corresponds to the car that begins at starts[i].Example 1:
Input: roads = [["Bridgewater", "Caledonia", "30"], ["Caledonia", "New Grafton", "15"], ["New Grafton", "Campground", "5"], ["Milton", "New Grafton", "30"], ["Liverpool", "Milton", "10"]], starts = ["Bridgewater", "Liverpool"], people = [["Jessie", "Bridgewater"], ["Travis", "Caledonia"], ["Jeremy", "New Grafton"], ["Katie", "Liverpool"]]
Output: [["Jessie", "Travis"], ["Katie", "Jeremy"]]
Explanation: Car 0, departing from "Bridgewater", picks up "Jessie" and "Travis". Car 1, departing from "Liverpool", picks up "Katie" and "Jeremy". Each person boards the car that arrives at their home first.
Example 2:
Input: roads = [["Riverport", "Chester", "50"], ["Chester", "Campground", "60"], ["Halifax", "Chester", "40"]], starts = ["Riverport", "Halifax"], people = [["Colin", "Riverport"], ["Sam", "Chester"], ["Alyssa", "Halifax"]]
Output: [["Colin"],["Alyssa","Sam"]]
Example 3:
Input: roads = [["Riverport", "Bridgewater", "1"], ["Bridgewater", "Liverpool", "1"], ["Liverpool", "Campground", "1"]], starts = ["Riverport", "Bridgewater"], people = [["Colin", "Riverport"], ["Jessie", "Bridgewater"], ["Sam", "Liverpool"]]
Output: [["Colin"], ["Jessie", "Sam"]]
Constraints:
starts, there is a single unbranched route to the Campground.1 <= roads.length <= 10^41 <= people.length <= 10^4duration > 0