Every morning, Lisa drives a public bus from one terminal stop to the other. Through months of careful observation, she has noticed that the order in which buses complete the route isn't necessarily the order in which they started. It is possible for the first bus to arrive at the first stop to not be the first bus to leave the last stop due to delays along the route. To leave work as early as possible, Lisa would like to figure out which bus will finish the route first on a given morning.
The route has
A bus takes one minute to travel from one stop to the next. Each bus can carry
Can you help Lisa by figuring out which bus she should drive to complete the route first?
Input Specification
The input will contain 10 datasets. Each dataset begins with two integers
For the first 4 datasets,
Output Specification
For each dataset, output Bus #X
, where X
is the index of the bus that will be the first to reach the last stop. If two buses tie for first, output the one with the lower index.
Sample Input (Two Datasets Shown)
5 3
1 2
2 3
4 5
13 6
1 7
2 8
3 9
4 10
5 11
6 12
Sample Output
Bus #1
Bus #2
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
To discourage hardcoding, the testcases are now shuffled between runs.
When your team got 4/10 by guessing during the actual ECOO
:)