CF119E.Alternative Reality
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In the year of 3000 travelling around parallel realities became a routine thing. However one has to take into consideration that travelling like that is highly dangerous as you never know beforehand where you're gonna get...
Little Vasya, for instance, found himself in a gaming reality and now he has to successfully complete all levels of a very weird game to get back. The gaming reality is a three-dimensional space where n points are given. The game has m levels and at the beginning of the i-th level the player is positioned at some plane Q__i that passes through the origin. On each level Vasya has to use special robots to construct and activate n powerful energy spheres of the equal radius with centers at the given points. The player chooses the radius of the spheres himself. The player has to spend R units of money to construct spheres whose radius equals R (consequently, one can construct spheres whose radius equals zero for free). Besides, once for each level a player can choose any point in space and release a laser ray from there, perpendicular to plane Q__i (this action costs nothing). The ray can either be directed towards the plane or from the plane. The spheres that share at least one point with the ray will be immediately activated. The level is considered completed if the player has managed to activate all spheres. Note that the centers of the spheres are the same for all m levels but the spheres do not remain: the player should construct them anew on each new level.
Help Vasya find out what minimum sum of money will be enough to complete each level.
在公元3000年,穿梭于平行宇宙已成为一项日常活动。然而,必须考虑到此类旅行具有极高危险性,因为你永远无法事先预知自己将抵达何处……
例如,小瓦夏(Little Vasya)便意外进入了一个游戏宇宙,如今他必须成功通关一款极其怪异的游戏的所有关卡,才能返回原来的世界。该游戏宇宙是一个三维空间,其中给定 $ n $ 个点。游戏共有 $ m $ 关,而在第 $ i $ 关开始时,玩家位于某个过原点的平面 $ Q_i $ 上。在每一关中,瓦夏需借助特殊机器人,在给定点处分别构建并激活 $ n $ 个半径相等的强大能量球体。玩家可自行选定球体的半径。构建半径为 $ R $ 的球体需花费 $ R $ 单位金钱(因此,构建半径为零的球体是免费的)。此外,每关中玩家可额外免费执行一次操作:任选空间中一点,并从此点向平面 $ Q_i $ 发射一条垂直于 $ Q_i $ 的激光束(该操作不消耗金钱)。此激光束可朝向平面 $ Q_i $ 发射,也可背离平面 $ Q_i $ 发射。所有与该激光束至少有一个公共点的能量球体将立即被激活。当所有球体均被激活时,该关即视为完成。注意:所有 $ m $ 关中球体的中心位置均保持不变,但球体本身并不保留——玩家需在每一关重新构建全部球体。
请帮助瓦夏计算,为顺利通关每一关所需的最少总金钱数。
输入格式
The first line contains two integers n and m (1 ≤ n ≤ 900, 1 ≤ m ≤ 100) — the number of energetic spheres and the number of levels in the game correspondingly.
Each of the following n lines contains three integers x__i, y__i, z__i (0 ≤ x__i, y__i, z__i ≤ 104) — the coordinates of the center of the i-th sphere. Assume that these points do not change their positions throughout the game.
Then follow m lines, each containing three integers a__i, b__i, c__i (0 ≤ a__i, b__i, c__i ≤ 100, _a__i_2 + _b__i_2 + _c__i_2 > 0). These numbers are the coefficients in the equation of plane Q__i (a__i__x + b__i__y + c__i__z = 0), where the player is positioned at the beginning of the i-th level.
第一行包含两个整数 n 和 m(1≤n≤900,1≤m≤100),分别表示能量球的数量和游戏的关卡数。
接下来的 n 行中,每行包含三个整数 xi、yi、zi(0≤xi,yi,zi≤104),表示第 i 个球心的坐标。假设这些点在整个游戏过程中位置保持不变。
随后是 m 行,每行包含三个整数 ai、bi、ci(0≤ai,bi,ci≤100,且 ai2+bi2+ci2>0)。这些数是第 i 关平面 Qi 的方程 aix+biy+ciz=0 的系数,玩家在第 i 关开始时位于该平面上。
输出格式
Print m numbers, one per line: the i-th line should contain the minimum sum of money needed to complete the i-th level. The absolute or relative error should not exceed 10 - 6.
输出 m 个数字,每行一个:第 i 行应包含完成第 i 级所需的最少金钱总和。绝对或相对误差不得超过 10−6。
输入输出样例
输入#1
4 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1
输出#1
0.7071067812
输入#2
5 3 0 1 0 1 0 1 1 2 1 2 0 1 1 3 0 1 1 1 1 2 3 3 0 3
输出#2
1.6329931619 1.6366341768 1.5411035007
输入#3
2 1 0 20 0 0 0 0 0 10 0
输出#3
0.0000000000
输入解题思路,AI测评打分。不知道怎么写?