Ivan Pesic and His World Tour
Chef is very popular, so his friends visit him often. Chef's friend Pesic decided to come visit him in Chefland during one of Pesic's famous world tours, but he got lost along the way and ended up in Queryland. Queryland has a weird structure: it has $N$ cities (numbered $1$ through $N$) and $N-1$ bidirectional roads connecting them in such a way that it is possible to reach any city in Queryland
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