← All problemsSign in

Trip and Palindromes

CodeChefRating 3062Open on judge ↗

Serega is an avid traveller. He has already visited numerous exotic places, and now wants to embark on a journey to Treeland. There are N cities in Treeland that Serega wants to visit. Also, roads have been laid between some N-1 pairs of cities in Treeland. Roads are bidirectional, and there exists a unique path between any two Treeland cities. Each of Treeland's roads has its own class, wich is

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