Lovers Gift
Chef buys lots of gifts for his love Chefua. Chef keeps all his money in the bank, and so if he wants to buy a gift, he must go to one of the branches of the bank in the country to get money, and then buy the gift. The country where Chef lives consists of N cities which are connected by N - 1 bidirectional roads in such way that there is a unique path from any city to any other city. The cities n
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