Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=66;
const double eps=1e-8;
int n,k;
long double x[N],y[N],c[N];
long double x1,y1,x2,y2;
long double dis(long double x1,long double y1,long double x2,long double y2)
{
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
bool intersection(int i,int j,long double T)
{
    long double A=-2*x[i],B=-2*y[i],C=x[i]*x[i]+y[i]*y[i]-(T/c[i])*(T/c[i]);
    long double D=-2*x[j],E=-2*y[j],F=x[j]*x[j]+y[j]*y[j]-(T/c[j])*(T/c[j]);
    if(fabs(B-E)<eps)
    {
        assert(0);
        //if(dis(x[i],y[i],x[j],y[j])>T/c[i]+T/c[j]) return false;
        x1=x2=(F-C)/(A-D);
        long double s=1,t=B,f=x1*x1+A*x1+C;
        if(t*t-4*s*f<0) return false;
        long double p=sqrt(t*t-4*s*f);
        y1=(-t-p)/2/s;y2=(-t+p)/2/s;
        return true;
    }
    long double k=(D-A)/(B-E),b=(F-C)/(B-E);
    long double s=k*k+1,t=2*b*k+A+B*k,f=b*b+B*b+C;
    if(t*t-4*s*f<0) return false;
    long double p=sqrt(t*t-4*s*f);
    x1=(-t-p)/2/s;x2=(-t+p)/2/s;
    y1=k*x1+b;y2=k*x2+b;
    return true;
}
bool judge(long double T)
{
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
    {
        if(!intersection(i,j,T)) continue;
        int a=0,b=0;
        for(int k=1;k<=n;k++)
        {
            if(dis(x1,y1,x[k],y[k])<=T/c[k]) a++;
            if(dis(x2,y2,x[k],y[k])<=T/c[k]) b++;
        }
        if(a>=k||b>=k) return true;
    }
    return false;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        cin>>x[i]>>y[i]>>c[i];
    cout<<judge(2.4);return 0;
    long double l=0,r=150000,ans;
    for(int i=1;i<=50;i++)
    {
        long double m=(l+r)/2;
        if(judge(m)) ans=m,r=m;
        else l=m;
    }
    printf("%.10f\n",(double)ans);
}


Compiler output:
a.cc:7:16: error: 'long double y1' redeclared as different kind of entity
    7 | long double x1,y1,x2,y2;
      |                ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'bool intersection(int, int, long double)':
a.cc:24:11: error: assignment of function 'double y1(double)'
   24 |         y1=(-t-p)/2/s;y2=(-t+p)/2/s;
      |         ~~^~~~~~~~~~~
a.cc:32:7: error: assignment of function 'double y1(double)'
   32 |     y1=k*x1+b;y2=k*x2+b;
      |     ~~^~~~~~~
a.cc: In function 'bool judge(long double)':
a.cc:44:19: error: cannot convert 'double (*)(double) noexcept' to 'long double'
   44 |             if(dis(x1,y1,x[k],y[k])<=T/c[k]) a++;
      |                ~~~^~~~~~~~~~~~~~~~~
      |                   |
      |                   double (*)(double) noexcept
a.cc:8:44: note:   initializing argument 2 of 'long double dis(long double, long double, long double, long double)'
    8 | long double dis(long double x1,long double y1,long double x2,long double y2)
      |                                ~~~~~~~~~~~~^~