#P7700. [2019年杭电多校]geometric problem
[2019年杭电多校]geometric problem
geometric problem
Problem Description
There are six points in a two-dimensional plane. As shown in the figure below, and are both in convex quadrilateral shapes, and their intersection area is . You are also given two lines and . You have to choose one point on each line (for example, on and on ) so that the area of , , and are at the same size. Moreover, should lie within or be on the border of , and should lie within or be on the border of . Please output the positions of and that you choose!
Input
The first line contains an integer indicating the number of test cases.
Each test case consists of three lines. The first line contains integers, $A_x, A_y, B_x, B_y, M_x, M_y, N_x, N_y, X_x, X_y, Y_x, Y_y$, denoting the and coordinates of points . The second line contains integers, , and , denoting two distinct points on . The third line also contains integers, , and , denoting two distinct points on .
- coordinates are in the range
- ,
Output
For each test case output numbers in a single line, , denoting the two chosen points. If there are multiple solutions, output the one with the smallest . If there are still multiple solutions, output the one with the smallest , and then the smallest , and then the smallest . Otherwise, if there are no solution, output "-1" (without quotes) in one line. A solution with an absolute error at most will be accepted.
Sample Input
1
0 10 0 0 5 10 5 0 10 10 10 0
0 0 5 10
5 0 10 10
Sample Output
3.333333333333 6.666666666667 6.666666666667 3.333333333333
Source
2019 Multi-University Training Contest 5