Some travelling salesmen would like to market their fine wares to
Salesmen can be found at company offices, which can be found in a select few of these cities.
Now, given that the cities are connected with
Note: You may assume that there are at least
Input Specification
Following this will be
Following this will be
Bonus: one case will have
Output Specification
The number of hours it will take for news of the product to spread.
Sample Input
4 3
1 2
2 3
3 4
2
1
2
Sample Output
2
City 4 will be visited last.
Comments
me: Mom, I want to solve a Travelling Salesman problem
mom: We have a Travelling Salesman problem at home
Travelling Salesman problem at home: