Non Overlapping Segments
CodeChefOpen on judge ↗
You are given **N** horizontal segments each of length **R**. You are given the x-coordinates of their left end-points: the i-th segment has the left end point at **$x_i$**. You can see that the right end point will be at **$x_i + R$**. You want to move the segments such that they lie entirely in the range **[0, L]**. After the movements, no two segments should overlap, however, they are allowed
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