You promised your girlfriend a rounded cake with at least SS strawberries.

But something goes wrong, you don't have the final cake but an infinite plane with NN strawberries on it. And you need to draw a circle which contains strawberries completely to make the cake by yourself.

To simplify the problem, the strawberries are represented as circles in 22D plane. Every strawberry has its center (X_i, Y_i)(Xi​,Yi​) and the same radius RR.

The cost of your cake is the radius of the circle you draw. So you want to know the minimal cost of the cake, or if you can't give your girlfriend such a cake.

Input

The input file contains several test cases.

The first line of the file is an integer TT, giving the number of test cases. (T\leq20)(T≤20)

For each test case, there are two integers NN and SS in the first line, denoting the number of total strawberries and the number of strawberries on cake as you promised. (1\leq N, S \leq 300)(1≤N,S≤300)

In the following NN lines, each line contains two integers X_i, Y_iXi​,Yi​, denoting the coordinates of the strawberry center. (0\leq X_i, Y_i\leq 10000)(0≤Xi​,Yi​≤10000)

The next line contains one integer RR, denoting the radius of all strawberries. (1\leq R \leq 10000)(1≤R≤10000)

It's guaranteed that sum of NN is smaller than 10001000.

Output

Output the minimal cost correct to four decimal places if you can make a rounded cake with at least SSstrawberries, or "The cake is a lie." if not.

样例输入

2

5 3

0 0

0 2

2 0

0 0

1 1

1

1 2

0 0

1

样例输出

1.7071
The cake is a lie.
题意是给你一堆半径相等的圆,让你求一个最小的圆能覆盖其中至少m个圆

首先把他给的圆看成点,然后找个最小的圆覆盖覆盖其中至少m个点,然后答案就是现在找的这个圆的半径加那一堆圆的半径
二分一个答案,以每个点的圆心为圆心,二分的答案为半径画圆,能被覆盖的点必然画出的圆相交。
对这些圆极角排序,然后扫描,圆第一次被扫描到就+,第二次被扫描到就-,这个过程中的最大值就是能覆盖的点
意会一下……

#include<bits/stdc++.h>
#define eps 0.000000001
using namespace std;
const int N=;
int n,m,T;
double R;
struct Point{
double x,y;}p[N];
struct orz{
double du;
int flag;}a[*N];
bool cmp(orz a,orz b)
{
if (a.du!=b.du) return a.du<b.du;
return a.flag>b.flag;
}
double dist(Point a,Point b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double f(Point a,Point b)
{
return atan2(b.y-a.y,b.x-a.x);
}
bool check(double x)
{
int ans=;
for (int i=;i<=n;i++)
{
int cnt=;
for (int j=;j<=n;j++)
{
if (j==i) continue;
if (dist(p[i],p[j])<=*x)
{
double mid=f(p[j],p[i]);
double xx=acos(dist(p[i],p[j])/2.0/x);
a[cnt].du=mid-xx; a[cnt++].flag=;
a[cnt].du=mid+xx; a[cnt++].flag=;
}
} sort(a,a+cnt,cmp);
int tmp=;
for (int j=;j<cnt;j++)
{
if (a[j].flag) tmp++;
else tmp--;
ans=max(ans,tmp);
}
}
return ans>=m;
}
int main()
{
scanf("%d",&T);
while (T--)
{
scanf("%d%d",&n,&m);
for (int i=;i<=n;i++) scanf("%lf%lf",&p[i].x,&p[i].y);
scanf("%lf",&R); double l=,r=1e5,ans=-;
for (int i=;i<=;i++)
{
double mid=(l+r)/2.0;
if (check(mid)) r=mid,ans=mid;
else l=mid;
}
if (ans<) printf("The cake is a lie.\n");
else printf("%.4f\n",ans+R);
}
return ;
}

ACM-ICPC2018 沈阳赛区网络预赛-E-The cake is a lie的更多相关文章

  1. ACM-ICPC 2018 沈阳赛区网络预赛 K Supreme Number(规律)

    https://nanti.jisuanke.com/t/31452 题意 给出一个n (2 ≤ N ≤ 10100 ),找到最接近且小于n的一个数,这个数需要满足每位上的数字构成的集合的每个非空子集 ...

  2. ACM-ICPC 2018 沈阳赛区网络预赛-K:Supreme Number

    Supreme Number A prime number (or a prime) is a natural number greater than 11 that cannot be formed ...

  3. ACM-ICPC 2018 沈阳赛区网络预赛-D:Made In Heaven(K短路+A*模板)

    Made In Heaven One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. ...

  4. 图上两点之间的第k最短路径的长度 ACM-ICPC 2018 沈阳赛区网络预赛 D. Made In Heaven

    131072K   One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. Howe ...

  5. ACM-ICPC 2018 沈阳赛区网络预赛 J树分块

    J. Ka Chang Given a rooted tree ( the root is node 11 ) of NN nodes. Initially, each node has zero p ...

  6. ACM-ICPC 2018 沈阳赛区网络预赛 K. Supreme Number

    A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying ...

  7. ACM-ICPC 2018 沈阳赛区网络预赛 F. Fantastic Graph

    "Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a ...

  8. ACM-ICPC 2018 沈阳赛区网络预赛 F Fantastic Graph(贪心或有源汇上下界网络流)

    https://nanti.jisuanke.com/t/31447 题意 一个二分图,左边N个点,右边M个点,中间K条边,问你是否可以删掉边使得所有点的度数在[L,R]之间 分析 最大流不太会.. ...

  9. ACM-ICPC 2018 沈阳赛区网络预赛 B Call of Accepted(表达式求值)

    https://nanti.jisuanke.com/t/31443 题意 给出一个表达式,求最小值和最大值. 表达式中的运算符只有'+'.'-'.'*'.'d',xdy 表示一个 y 面的骰子 ro ...

  10. ACM-ICPC 2018 沈阳赛区网络预赛 G Spare Tire(容斥)

    https://nanti.jisuanke.com/t/31448 题意 已知a序列,给你一个n和m求小于n与m互质的数作为a序列的下标的和 分析 打表发现ai=i*(i+1). 易得前n项和为 S ...

随机推荐

  1. Scrum立会报告+燃尽图(十月十三日总第四次):前期宣传相关工作

    此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2194 Scrum立会master:刘欣 一.小组介绍 组长:付佳 组员: ...

  2. UML设计(团队作业6)

    决胜 Poker 一.团队成员 学号 姓名 211606392 郑俊瑜 (队长) 211606327 冉繁盛 211606323 刘世华 211606386 姚皓钰 211606358 陈卓楠 211 ...

  3. 按照Right-BICEP要求设计的测试用例

    测试用例: 测试方法:Right-BICEP 测试要求: Right-结果是否正确? B-是否所有的边界条件都是正确的? P-是否满足性能要求? 题目是否有重复? 数量是否可定制? 数值范围是否可定制 ...

  4. Android开发第二阶段(2)

    昨天:总结了第一阶段的开发经验 今天:学习了一下java中对事件处理这块的初步了解比如设置监听器等 明天:我会走进我们的代码去看看相关的一些知识.

  5. HDU 4747 Mex 递推/线段树

    题目链接: acm.hdu.edu.cn/showproblem.php?pid=4747 Mex Time Limit: 15000/5000 MS (Java/Others)Memory Limi ...

  6. 第一阶段android学习笔记

    1.学习<第一行代码> 第一个android项目: 项目的注意点,如创建项目时包名具有唯一性,在做项目的时候要手动改成Project模式.还知道了引用字符串的两种方式. AS项目的三种依赖 ...

  7. Alpha 冲刺10

    队名:日不落战队 安琪(队长) 今天完成的任务 整理项目. okhttp学习第四弹. 明天的计划 okhttp学习第五弹. 阶段反思. 睡觉. 还剩下的任务 个人信息数据get. 遇到的困难 困难:好 ...

  8. HTMLA内联框架

    <head> <meta charset="utf-8" /> <title>内联框架</title> </head> ...

  9. Beta阶段冲刺第一天

    提供当天站立式会议照片一张 讨论项目每个成员的昨天进展 昨天开始了Beta阶段的冲刺,总体讨论了一下这个阶段的任务,然后明确了个人分工. 讨论项目每个成员的存在问题 第一天暂时还没有什么问题,可能最大 ...

  10. Robot 模拟操作键盘 实现复制粘贴功能;

    1.代码逻辑 : a.封装一个粘贴的方法体:setAndctrlVClipboardData(String string);参数string是需要粘贴的内容 : b.声明一个StringSelecti ...