Problem 3009 --geometric problem

3009: geometric problem

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $2$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
There are six points ABMNXYABMNXY in a two-dimensional plane. 

As shown in the figure below, ABNMABNM and XYNMXYNM are both in convex quadrilateral shapes, and their intersection area is 00. You are also given two lines L1L1 and L2L2. You have to choose one point on each line (for example, SS on L1L1 and TT on L2L2) so that the area of ABSABSMSNTMSNT, and XYTXYT are at the same size. Moreover, SS should lie within or be on the border of ABNMABNM, and TT should lie within or be on the border of XYNMXYNM. Please output the positions of SS and TT that you choose! 



The first line contains an integer TT indicating the number of test cases. 

Each test case consists of three lines. The first line contains 1212 integers, Ax,Ay,Bx,By,Mx,My,Nx,Ny,Xx,Xy,Yx,YyAx,Ay,Bx,By,Mx,My,Nx,Ny,Xx,Xy,Yx,Yy, denoting the xx and yy coordinates of points A,B,M,N,X,YA,B,M,N,X,Y. The second line contains 44 integers, L11,x,L11,y,L12,xL11,x,L11,y,L12,x, and L12,yL12,y, denoting two distinct points on L1L1. The third line also contains 44 integers, L21,x,L21,y,L22,xL21,x,L21,y,L22,x, and L22,yL22,y, denoting two distinct points on L2L2

1≤T≤201≤T≤20 

* coordinates are in the range [0,514][0,514] 

L11≠L12L11≠L12L21≠L22
For each test case output 44 numbers in a single line, Sx,Sy,Tx,TySx,Sy,Tx,Ty, denoting the two chosen points. If there are multiple solutions, output the one with the smallest SxSx. If there are still multiple solutions, output the one with the smallest SySy, and then the smallest TxTx, and then the smallest TyTy. Otherwise, if there are no solution, output "-1" (without quotes) in one line. A solution with an absolute error at most 10−610−6 will be accepted.
1
0 10 0 0 5 10 5 0 10 10 10 0
0 0 5 10
5 0 10 10
3.333333333333 6.666666666667 6.666666666667 3.333333333333

推荐代码 查看3009 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战 淡意的温柔 590710 2020-06-05 08:39:45

赛题来源/所属竞赛 2019 Multi-University Training Contest 5 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛