主页
试题仓库
题目列表
试题分类
经典教材
作业竞赛
作业列表
判题队列
图灵学院
TuringMOOC
图灵书屋
图灵商城
图灵实验室
图灵会员
荣誉成绩
捐赠支持
图灵云编译器
用户/排名
AOJ排名
实名认证
请登录
常用链接
AOJ考试平台
老赵的Gitee代码
编译原理模拟考试平台
Java技术手册
FCC网站
菜鸟网
在线工具箱
字节豆包GPT
代码可视化
力扣网
牛客网
洛谷
杭电OJ
CodeForce
隐藏编译器
Problem 3068 --Closest Pair of Segments
3068: Closest Pair of Segments
上一题
正确率: $0.00\%$
下一题
Time Limit
$20$ 秒/Second(s)
Memory Limit
$512$ 兆字节/Megabyte(s)
提交总数
$1$
正确数量
$0$
"
裁判形式
标准裁判/Standard Judge
我的状态
尚未尝试
难度
分类标签
×
为本题添加算法分类(请不要超过5个)
当前分类(单击移除):
单击选择分类:
Description
<span style="font-family:"font-size:14px;">The closest pair of points problem is a well-known problem of computational geometry. In this problem, you are given </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>n<span style="font-family:"font-size:14px;"> points in the Euclidean plane and you need to find a pair of points with the smallest distance between them.</span><br /> <br /> <span style="font-family:"font-size:14px;">Now, Claris, the brilliant one who has participated in programming contests for several years, is trying to solve a harder problem named the closest pair of segments problem, which also has a quite simple description as above.</span><br /> <br /> <span style="font-family:"font-size:14px;">However, the problem seems even too hard for Claris and she is asking you for help.</span><br /> <br /> <span style="font-family:"font-size:14px;">Now </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>n<span style="font-family:"font-size:14px;"> segments are lying on the Euclidean plane, you are asked to pick two different segments and then pick a point on the two segments respectively to minimize the distance between these two points.</span><br /> <br /> <span style="font-family:"font-size:14px;">For simplicity, any two given segments share no common point, and you don't need to show her the two chosen points, but the distance between them instead.</span>
Input
<div class="panel_content" style="margin:0px;padding:0px 20px;font-size:14px;font-family:""> The input contains several test cases, and the first line contains a single integer <span class="MathJax_Preview" style="color:#888888;"></span>T (1≤T≤200), the number of test cases.<br /> For each test case, the first line contains one integer <span class="MathJax_Preview" style="color:#888888;"></span>n (2≤n≤10000), which is the number of segments on the Euclidean plane.<br /> The following <span class="MathJax_Preview" style="color:#888888;"></span>n lines describe all the segments lying on the Euclidean plane, the <span class="MathJax_Preview" style="color:#888888;"></span>i-th of which contains for integers <span class="MathJax_Preview" style="color:#888888;"></span>x1,y1,x2 and <span class="MathJax_Preview" style="color:#888888;"></span>y2 describing a segment that connects <span class="MathJax_Preview" style="color:#888888;"></span>(x1,y1) and <span class="MathJax_Preview" style="color:#888888;"></span>(x2,y2), where <span class="MathJax_Preview" style="color:#888888;"></span>−109≤x1,y1,x2,y2≤109.<br /> It's guaranteed that the two endpoints of each segment do not coincide, any two given segments do not intersect with each other in each test case, and no more than <span class="MathJax_Preview" style="color:#888888;"></span>20test cases satisfy <span class="MathJax_Preview" style="color:#888888;"></span>n>1000.<br /> </div> <div> <br /> </div>
Output
<span style="font-family:"font-size:14px;">For each test case, output a line containing a single real number for the answer to the closest pair of segments problem with an absolute or relative error of at most </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>10−6<span style="font-family:"font-size:14px;">.</span><br /> <br /> <span style="font-family:"font-size:14px;">Precisely speaking, assume that your answer is </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>a<span style="font-family:"font-size:14px;"> and and the jury's answer is </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>b<span style="font-family:"font-size:14px;">, your answer will be considered correct if and only if </span><span class="MathJax_Preview" style="color:#888888;font-family:"font-size:14px;"></span>|a−b|max{1,|b|}≤10−6<span style="font-family:"font-size:14px;">.</span>
Sample Input
2 2 0 1 1 2 1 1 2 0 2 0 1 1 2 2 2 3 1
Sample Output
0.707106781187 1.000000000000
推荐代码
查看3068 所有题解
上传题解视频得图灵币
本题记录
用 户(点击查看用户)
运行号(点击购买题解)
时 间
算法最快[$0 $ms]
0
内存最少[$0 $KB]
0
第一AC
0
第一挑战
淡意的温柔
588051
2020-05-27 09:38:35
赛题来源
2019 Multi-University Training Contest 10
登录后提交代码
题面与样例可直接查看,登录后即可在线提交和评测。
前往登录