#P4579. [FJOI2018] 邮递员问题
[FJOI2018] 邮递员问题
Description
Since , the online shopping market has developed rapidly, and courier companies have become a key part of making transactions successful. Xiao Guo is an SF Express courier. His salary mainly includes a basic wage, delivery commission, pickup commission, other benefits and subsidies, etc. For each completed parcel order, Xiao Guo can usually get a commission of of the shipping fee. Therefore, the more orders he completes and the faster he completes them, the higher his income will be.
Xiao Guo is responsible for all courier services on parallel streets in the city. On these parallel streets, there are courier stations. Each delivery route starts from one station, and after delivering all parcels, ends at the other station. To finish the task efficiently, Xiao Guo wants to use the shortest route to complete all deliveries.
That is, given the distance between the parallel streets, the positions of the stations, and the positions of all delivery points, Xiao Guo needs to compute the shortest route that starts from one station, delivers all parcels, and finally returns to the other station.
The street distance means the vertical distance between the parallel streets. If we set the axis parallel to the streets, and the leftmost positions on both streets have , then any position on the streets can be represented by the straight-line distance from the leftmost end of the street to that position, i.e., the coordinate value of that position.
For example, suppose the street distance between streets A and B is . The two stations and are located at street A, , and street B, , respectively. There are also delivery points and located at street A, , and street B, , respectively, as shown in the figure. Xiao Guo’s task is to start from station , deliver the parcels at and , and then return to the other station .
Programming task: given the street distance of the parallel streets, the positions of the stations, and the positions of all delivery points, compute the shortest route that starts from one station, delivers all parcels, and ends at the other station.
Input Format
The first line contains two positive integers , , representing the number of positions on the two parallel streets A and B (including delivery points and station positions). The positions are numbered as A: ; B: .
The second line contains four positive integers , indicating that the two station positions are and . or means the corresponding station is on street , and or means the corresponding station is on street . and represent the position indices of the stations on the corresponding streets. For example, means the first station is on street , and its position is the -rd among the given positions of street .
The third line contains one real number , representing the street distance between the parallel streets .
The fourth line contains real numbers, representing the coordinates of the positions on street .
The fifth line contains real numbers, representing the coordinates of the positions on street .
Output Format
Output the computed shortest route length, rounded to decimal places.
2 2
0 1 1 2
2
1 3
1 3
6.83
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号