Problem 3506 --Divide and Conquer

3506: Divide and Conquer

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Given npoints in 2D plane, where n≡0(mod4), no two points coincide and no three points are collinear. Find two intersecting lines satisfying that no given points lie in the two lines and that for each of the four divided areas, there are exactly n4given points. If multiple solutions exist, print any one of them. If no solution, print "-1" in one line.
The first line contains one positive integer T(1≤T≤20), denoting the number of test cases. For each test case:
The first line contains one integer n(4≤n≤50000), denoting the number of given points.
Following nlines each contains two integers xi,yi(|xi|,|yi|≤106), denoting one given point (xi,yi).
It is guaranteed that ∑n≤105,n≡0(mod4), that no two points coincide and that no three points are collinear.
For each test case:
If no solution, print "-1" in one line. Else print two lines each containing four integers x1,y1,x2,y2((x1,y1)≠(x2,y2))with absolute value not exceeding 109, denoting one line passing (x1,y1),(x2,y2)simultaneously.
2
4
-1 -1
-1 1
1 -1
1 1
8
0 0
0 1
2 0
2 1
1 2
1 3
3 2
3 3
0 1 0 -1
1 0 -1 0
1 0 2 3
0 2 3 1

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

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 2020 Multi-University Training Contest 10 N/A

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