Find the Farthest City
CodeChefOpen on judge ↗
Surya loves travelling and in every trip he wishes to travel to two cities which are farthest from each other. To select the two cities he has data which shows the number of cities and distances between the cities which are connected directly. As all the cities are not connected directly so Surya is confused and he asks your help. He asks you $Q$ queries. In each query he gives you a city and you
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start