Help Needed in graph problem, Timus : Caravans

Please someone help me how to solve this problem : Problem Link