The town administration has decided to embellish the landscape by building new parks. To make the parks not only look good, but also be useful, they need to carefully choose which neighbourhoods to build the parks in so that the kids from the other neighbourhoods have at least one park near them.
The town consists of
Help the town administration determine which neighbourhoods should have a park built in them and determine the maximum distance from a neighbourhood to its closest park.
Input Specification
The first line contains two positive integers
The
Output Specification
In the first line, print the least possible maximum distance from the problem statement.
In the second line, print
Constraints
Subtask | Points | Constraints |
---|---|---|
1 | 10 | |
2 | 10 | |
3 | 30 | |
4 | 60 | No additional constraints. |
Sample Input 1
9 3
1 2 5
1 3 1
3 4 10
3 5 9
5 6 8
2 7 1
2 8 2
8 9 7
Sample Output 1
8
4 5 8
Sample Input 2
5 2
1 2 3
2 3 7
3 4 3
4 5 3
Sample Output 2
3
2 4
Sample Input 3
7 4
1 3 1
1 4 1
2 3 1
5 3 1
4 7 1
4 6 1
Sample Output 3
1
3 4 1 2
Explanation for Sample Output 3
If the parks were built only in neighbourhoods
Comments