Direct Segments
CodeChefOpen on judge ↗
$N$ line segments (numbered $1$ through $N$) are placed on the $2D$-plane. For each valid $i$, the $i$-th segment starts at $\vec{A_i} = (x_i, y_i)$ and ends at $\vec{B_i} = (X_i, Y_i)$. Line segments can move with a velocity of magnitude 1 unit/sec along the direction of vector $(\vec{A_i} - \vec{B_i})$ or $(\vec{B_i} - \vec{A_i})$. At the time $t = 0$, all segments start moving for each valid $
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