Distance between polygons

That’s all: Compute the distance between the sides of two given
polygons.

Input

Input consists of several cases. Each case begins with two numbers n and
m. Follow the n points that define the first polygon, and the m points
that define the second polygon. Assume 1 ≤ n, m ≤ 10³. All the given
coordinates are integer numbers with absolute value at most 10⁴.

Output

For every case, print its number followed by the minimum distance
between the sides of the two polygons, rounded to four digits after the
decimal point. If handled correctly, the input cases have no precision
issues.

Problem information

Author: Albert Graells

Generation: 2026-01-25T10:32:43.497Z

© Jutge.org, 2006–2026.
https://jutge.org
