编程介的小学生 2017-08-26 13:33 采纳率: 20.5%
浏览 885
已采纳

Light Bulbs 2

After a period of hard-working, mildleopard become rich and could buy many light bulbs. He run wires around his house before he bought light bulbs. But he didn't consider the weights of the light bulbs until he went to buy the light bulbs. He wanted to select the light bulbs that could make the place where his desk placed had maximum illumination. What's more, he also wanted to minimize the cost because he knew that the money was not easy to earn.

Remember that the illumination from a source can be calculated by the following equation:

, where E is the illumination of the point, I is the luminous intensity of the source, R is the distance between the source and the point and i is the angle between the normal of the plane and the light to the point.
Input

The first line of the input contains an integer T (T <= 30), indicating the number of cases.

The first lin of each test case contains two integers n and m, indicating the the number of light bulbs that mildleopard could connect in his house and that mildleopard could choose in the market. (1 <= n, m <= 100) Each of the next n lines contains four integers xi, yi, hi and wi, indicating the coordinates of the i-th outlet box and the weight that it can afford. (-100 <= xi, yi <= 100, 0 < hi <= 100, 0 < wi <= 1000000) Each outlet box can connect only one light bulbs whose weight doesn't exceed wi and the coordinates of the light bulb will be the same as the outlet box. Then m lines follow, each of which contains three integers Ii, Mi and Ci, indicating the luminous intensity, the weight and the cost of the i-th light bulb. (0 < Ii <= 32768, 0 < Mi, Ci <= 1000000, ) Assume that the desk is always placed at the original point.

Output

For each test case, output the maximum illumination mildleopard could get and the minimum cost to achieve it in one line. The maximum illumination should be a real number rounded to 0.001.

Sample Input

4
1 1
1 0 1 100
1 100 10
1 1
1 0 1 100
1 101 10
1 2
0 0 1 100
1 100 10
1 100 20
1 2
0 0 1 100
1 100 10
2 100 20
Sample Output

0.354 10
0.000 0
1.000 10
2.000 20

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-09-10 00:44
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行