Problem:
Score : 600 points

Problem Statement

Takahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \left(x_i, y_i\right), and its hardness is c_i.

Takahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \left(X, Y\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \times \sqrt{\left(X - x_i\right)^2 + \left(Y-y_i\right)^2} seconds.

Takahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.

Constraints

All values in input are integers.

1 \leq N \leq 60

1 \leq K \leq N

-1000 \leq x_i , y_i \leq 1000

\left(x_i, y_i\right) \neq \left(x_j, y_j\right) \left(i \neq j \right)

1 \leq c_i \leq 100

Input

Input is given from Standard Input in the following format:

N K
x_1 y_1 c_1
\vdots
x_N y_N c_N

Output

Print the answer.

It will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

4 3
-1 0 3
0 0 3
1 0 2
1 1 40

Sample Output 1

2.4

If we put the heat source at \left(-0.2, 0\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.

Sample Input 2

10 5
-879 981 26
890 -406 81
512 859 97
362 -955 25
128 553 17
-885 763 2
449 310 57
-656 -204 11
-270 76 40
184 170 16

Sample Output 2

7411.2252

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n, K; cin >> n >> K;
    --K;
    if(K == 0) {
        cout << 0.0 << endl;
        return;
    }
    vector<int> x(n), y(n), c(n);
    rep(i, n) {
        cin >> x[i] >> y[i] >> c[i];
    }
    ld ans = INF;
    for(int i = 0; i < n; ++i) {
        for(int j = i + 1; j < n; ++j) {
            ld l = 0.0, r = 1.0;
            rep(_, 80) {
                ld md1 = l + (r - l) / 3.0;
                ld md2 = l + (r - l) * 2.0 / 3.0;
                ld X = (md1 * (ld)x[i] + (1.0 - md1) * (ld)x[j]) ;
                ld Y = (md1 * (ld)y[i] + (1.0 - md1) * (ld)y[j]) ;
                vector<ld> a;
                rep(k, n) {
                    ld b = (ld)c[k] * pow((ld)(X - x[k]) * (ld)(X - x[k]) + (ld)(Y - y[k]) * (ld)(Y - y[k]), 0.5);
                    a.push_back(b);
                }
                sort(all(a));
                ld as1 = a[K];

                ld X1 = (md2 * (ld)x[i] + (1.0 - md2) * (ld)x[j]) ;
                ld Y1 = (md2 * (ld)y[i] + (1.0 - md2) * (ld)y[j]) ;
                vector<ld> a1;
                rep(k, n) {
                    ld b1 = (ld)c[k] * pow((ld)(X1 - x[k]) * (ld)(X1 - x[k]) + (ld)(Y1 - y[k]) * (ld)(Y1 - y[k]), 0.5);
                    a1.push_back(b1);
                }
                sort(all(a1));
                ld as2 = a1[K];

                if(as1 > as2) {
                    l = md1;
                    chmin(ans, as2);
                } else {
                    r = md2;
                    chmin(ans, as1);
                }
            }
        }
    }
    rep(i, n) {
        ld X = (ld)x[i];
            ld Y = (ld)y[i];
            vector<ld> a;
            rep(k, n) {
                ld b = (ld)c[k] * pow((ld)(X - x[k]) * (ld)(X - x[k]) + (ld)(Y - y[k]) * (ld)(Y - y[k]), 0.5);
                a.push_back(b);
            }
            sort(all(a));
            chmin(ans, a[K]);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}