/*
按距离排序后直接模拟
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define LL long long
struct point
{
LL x,y;
int k;
};
bool cmp(const point &p,const point &q)
{
return p.x*p.x+p.y*p.y<q.x*q.x+q.y*q.y;
}
point a[1111];
int main()
{
int n,s;
scanf("%d%d",&n,&s);
s=1000000-s;
for(int i=0;i<n;++i)
scanf("%lld%lld%d",&a[i].x,&a[i].y,&a[i].k);
sort(a,a+n,cmp);
int cnt=0;
for(int i=0;i<n;i++)
{
cnt+=a[i].k;
if(cnt>=s)
{
printf("%.7lf\n",sqrt((double)(a[i].x*a[i].x+a[i].y*a[i].y)));
return 0;
}
}
printf("-1\n");
return 0;
}
424 B. Megacity
最新推荐文章于 2022-01-28 14:24:06 发布