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 nn and mm. Follow the nn points that define the first polygon, and the mm points that define the second polygon. Assume 1n,m1031 \le n, m \le 10^3. All the given coordinates are integer numbers with absolute value at most 10410^4.

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