Consider a highway described as a sequence of service stations. Each service station is located at a distance from the beginning of the highway expressed in kilometers by a positive or zero integer. There are no two service stations having the same distance: each service station is therefore uniquely identified by its distance from the beginning of the highway.
Each service station is equipped with a fleet of electric rental vehicles. Each vehicle is distinguished by the range given by a battery charge, expressed in kilometers, by a positive integer. The fleet of vehicles of a single station includes at most 512 vehicles. By renting a car from an
A trip is identified by a sequence of service stations at which the driver stops. It therefore begins
at one service station and ends at another, passing through zero or more intermediate stations. Assume that the
driver cannot turn back during the trip, and rents a new car each time he stops at
a service station. Then, given two consecutive stops
The goal of the project is the following: given a pair of stations, plan the route with the least number of stages between them. In case there are multiple routes with the same minimum number of stops (i.e., tied), the route that prefers the stops with the shortest distance to the beginning of the highway should be chosen.
In other words, consider the set of
The only
The following is an example of a highway. In this example, the correct path between the station at distance 20 and the station at distance 50 is 20 → 30 → 50 (and not 20 → 45 → 50). Note that, instead, 50 → 30 → 20 is the correct path between the station at distance 50 and the station at distance 20 (thus in the right-to-left direction).