Ant Colonies

Problem #34

Tags: geometry puzzle

Who solved this?

Previous:The Lake Voyage Next:Blocked View


Ants are often territorial, marking clear boundaries across which ants from neighboring colonies are not allowed to cross. Let's imagine 3 ant colonies, represented here in Red, Blue, and Green. Each colony is centered on a fixed main anthill which houses the Queen, although each colony's influence extends beyond the central Queen. Each will explore and expand their territory in a fixed radius from the central Queen, so that their colony will always be a perfect circle. Ants will not tolerate the boundaries of their colonies to overlap, but over time a stable equilibrium will be formed such that each colony will share a boundary with each other.

Ant Colonies

See that each colony is centered on the central anthill, and also touches each of the other colonies.

Given the (x, y) coordinates of each colony's central anthill, determine the areas of each colony's territory after a stable state has been reached.

Problem Statement

Input Data
The first line will be Q, the quantity of testcases.
Q lines will then follow, each with six space-separated values in the format Ax Ay Bx By Cx Cy, being the xy coordinates of each of the three colonies A, B, and C respectively.

Answer
Should consist of Q sets of 3 space-separated values each, corresponding to the areas of the colonies A, B, and C respectively in each testcase.
Error should be less than 1e-4.

Example

input data:
2
-8 3 7 4 4 8
-1.234 -5.678 -1.234 5.678 1.234 -5.678

answer:
11.517 3.517 1.483 1.101 10.255 1.367
You need to login to get test data and submit solution.