← All problemsSign in

Cities and Villages

Kalia has been working on his app for a while and he decided to take a break. He wanted to take a trip in Tamil Nadu, covering some cities and villages. All cities and villages form a network, with highways connecting some pairs of cities or villages. There is exactly one path between any pair of cities or villages. A trip is defined to be any simple path in this network. The villages have a spec

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start