← All problemsSign in

Prof X Pays a Visit

Prof. X was the most annoying teacher in Chef's college, a teacher who none of the engineering students would love to have. Now, after 10 years, Prof. X visits Chef's country and contacts Chef to help him plan out his visit throughout the country. There are N cities in the country connected by M bidirectional roads each having a certain cost. You can think of the layout of the country as an acycl

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