Woburn Challenge 2017-18 Round 4 - Senior Division
The Infinity War has begun! Black Panther is well aware of the importance of rallying his supporters together to help defend Earth from the evil Thanos, so he's working on unifying the Wakandan army. Unbeknownst to him, however, Loki has formed a secret alliance with Thanos and is planning on sabotaging Black Panther's efforts.
The nation of Wakanda consists of
For example, if
Loki has the explosive resources to destroy
Upon realizing that some roads have been destroyed, Black Panther will
still do his best to assemble the Wakandan army together. He'll ask
soldiers to travel amongst various cities which are still connected by
the remaining roads. Overall, the amount of time required for this
mobilization will depend on a single factor – the maximum shortest
distance (along undestroyed roads) between any pair of cities which are
still reachable from one another at all. In other words, if
For example, if Loki were to destroy the two roads indicated in red
below, then the maximum shortest path between any pair of connected
cities would be
Naturally, Loki is interested in selecting a set of
Subtasks
In test cases worth
Input Specification
The first and only line of input consists of three space-separated
integers,
Output Specification
Output a single integer, the maximum achievable shortest distance between any pair of cities which are still connected (in km).
Sample Input
2 4 4
Sample Output
6
Sample Explanation
Loki may choose to destroy the four roads indicated in red below. The
shortest path between the pair of cities marked in green would then be
Comments