Exploring Cities
CodeChefOpen on judge ↗
There are $N$ cities in a country and all the cities are connected in form of a tree. There are $K$ special cities that have treasure hidden in them. Chef is interested to explore these special cities, every city has a portal that takes chef to any city he wants and returns him back to the same city. For example, if chef is in the city $i$ and he wants to explore cities $j$ and $k$, on the 1st
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