-->
当前位置:首页 > 题库

PROGRAMMING:Intercity emergency rescue

Luz5年前 (2021-05-10)题库479
As the head of a city's emergency rescue team, you have a special map of the country. The map shows several scattered cities and some expressways connecting the cities. The number of rescue teams in each city and the length of each expressway connecting the two cities are marked on the map. When other cities have emergency calls for you, your task is to lead your rescue team to the destination as soon as possible, and at the same time, gather as many rescue teams as possible along the way.
###Input format:
Enter the first line to give four positive integers $$n $$, $$M $$, $$s $$, $$d $$, where $$n $$($$2 / Le n / Le 500 $$) is the number of cities. By the way, assume that the number of cities is 0 ~ $$(n-1) $$$ M $$is the number of expressways$$ S $$is the city number of the origin$$ D $$is the city number of the destination.
The second line gives a positive integer of $$n $, where the number of $$I $$is the number of rescue teams in the city of $$I $, separated by spaces. In the following $$M $$lines, each line gives the information of an expressway, which is the length of city 1, city 2 and expressway, separated by spaces, and the numbers are integers and no more than 500. The input guarantees that the rescue is feasible and the optimal solution is unique.
###Output format:
The first line outputs the number of shortest paths and the largest number of rescue teams that can be called. The second line outputs the city number that passes through the path from $$s $$to $$d $. The numbers are separated by spaces, and there should be no extra spaces at the end of the output.
###Input example:
```in
4 5 0 3
20 30 40 10
0 1 1
1 3 2
0 3 3
0 2 2
2 3 2
```
###Output example:
```out
2 60
0 1 3
```






answer:If there is no answer, please comment