Consider two infinite horizontal lines and , separated units apart. The line has points at the abscissae . The line has points at the abscissae . Given different indices choosen from , and different indices choosen from , define as the Euclidean distance between and , that is,
You are given , , and the points in and in . Pick and in order to
minimize
Input consists of several cases, each one with only integer numbers. Every case begins with four strictly positive numbers , , and . Follow . Follow . Assume , , and that the absolute value of each abscissa is at most .
Additionally, assume that and are at most .
For every case, print the result with four digits after the decimal
point. If you use the long double type, the input cases
have no precision issues.
Author: Salvador Roura
Generation: 2026-01-25T10:09:04.522Z
© Jutge.org, 2006–2026.
https://jutge.org