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

PROGRAMMING:Train dispatching

Luz5年前 (2021-05-10)题库407
The structure of the train dispatching track of the railway station is shown in the figure below.
![](~/ 188)
The two ends are an entrance track and an exit track, and there are 'n' parallel tracks between them. Each train can choose any track to enter from the entrance, and finally leave from the exit. In the figure, there are nine trains waiting for entry at the entrance in the order of {8, 4, 2, 5, 3, 9, 1, 6, 7}. If they are required to leave from the exit in descending order, at least how many parallel tracks are needed for dispatching?
###Input format:
Enter the first line to give an integer 'n' (2 $$$Le $$'n '$$Le 10 ^ 5 $$), and the next line to give a rearrangement of integer sequence numbers from 1 to' n '. Numbers are separated by spaces.
###Output format:
Output the minimum number of tracks required to transfer the input train out in descending order in one line.
###Input example:
```in
nine
8 4 2 5 3 9 1 6 7
```
###Output example:
```out
four
```






answer:If there is no answer, please comment