A8357 | Alternative Reality
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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}<=10^{4}$ ) — 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.
Each of the following $n$ lines contains three integers $x_{i}$ , $y_{i}$ , $z_{i}$ ( $0<=x_{i},y_{i},z_{i}<=10^{4}$ ) — 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.
输出格式
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}$ .
输入输出样例
输入 #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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted