TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Association of Collision Management (ACM) is planning to perform the controlled collision of two as-
teroids. The asteroids will be slowly brought together and collided at negligible speed. ACM expects
asteroids to get attached to each other and form a stable object.


Each asteroid has the form of a convex polyhedron. To increase the chances of success of the experiment
ACM wants to bring asteroids together in such manner that their centers of mass are as close as possible.
To achieve this, ACM operators can rotate the asteroids and move them independently before bringing
them together.


Help ACM to find out what minimal distance between centers of mass can be achieved.


For the purpose of calculating center of mass both asteroids are considered to have constant density.

Input Format

There are multiple test cases, terminated by EOF.


Input file contains two descriptions of convex polyhedra.
The first line of each description contains integer number n -- the number of vertices of the polyhedron
(4 <= n <= 60). The following n lines contain three integer numbers xi; yi; zi each -- the coordinates of
the polyhedron vertices (-104 <= xi, yi, zi <= 104). It is guaranteed that the given points are vertices of a
convex polyhedron, in particular no point belongs to the convex hull of other points. Each polyhedron is
non-degenerate.


The two given polyhedra have no common points.

Output Format

Output one floating point number -- the minimal distance between centers of mass of the asteroids that
can be achieved. Your answer must be accurate up to 10-5.

Sample Input 1

8
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
5
0 0 5
1 0 6
-1 0 6
0 1 6
0 -1 6
8
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
5
0 0 5
1 0 6
-1 0 6
0 1 6
0 -1 6

Sample Output 1

0.75
0.75

Hints

Info: 本題輸出為浮點數,絕對或相對誤差 1e-5 以下視為正確

Problem Source

Migrated from old NTUJ.

NEERC 2009

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200