← All problemsSign in

Segments and Cities

The country Mangli is represented by X axis where each point P on X axis represents a city numbered P. City numbered P is at distance of P units from origin. As Mangli is not a developed country so connectivity between cities is an issue, There are some segments which represent [L, R] in which there are facilities available for transportation. You can move from any city A to city B such that the

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