158. The Toll Road
A network of cities is connected by two-way roads. Each road has a travel time, and each city charges a toll whenever you pass through it. The toll for the starting city is charged once at the beginning of the trip; the destination city's toll is charged as well. If a route visits a city again, its toll is charged again.
You are given pedagios, where pedagios[i] is the toll charged by city i, estradas, where each road is represented by [a, b, tempo], and limite, the maximum allowed travel time. The trip starts at city 0 and ends at city n - 1, where n is the length of pedagios.
Return the minimum total toll among routes whose total travel time is at most limite. If no valid route exists, return -1.
- 1 <= pedagios.length <= 1000
- 0 <= pedagios[i] <= 10^9
- 0 <= estradas.length <= 5000
- Each road has the form [a, b, tempo], where 0 <= a, b < pedagios.length and a != b.
- 1 <= tempo <= 5000
- 0 <= limite <= 5000
Run checks these 3 cases. Submit runs all 12, including hidden ones.