- 把点排一下序,对每个点算一下与它相邻的2000个点的b,就能通过10/11个点,再卡一卡时限改成算12000个就直接通过了……原来百度之星决赛的数据这么弱呀……
- 正解是,椭圆相交(相切)不易处理,考虑坐标变换,把横坐标都除上a,纵坐标都除上b,这样一番伸缩变换后椭圆就都化成圆了,然后就变成求平面最近点对了
#include <bits/stdc++.h>
using namespace std;
const double eps=1e-8;
typedef pair<double,double> pdd;
pdd p[100005];
double a;
double calc(double xi,double yi,double xj,double yj)
{double x=(xi+xj)/2;double y=(yi+yj)/2;if(abs(y-yi)<eps){return 2e7;}return sqrt(pow(y-yi,2)/(1-pow((x-xi)/a,2)));
}
int main()
{ios::sync_with_stdio(false);cin.tie(0);int T;cin>>T;while(T--){int n,a0;cin>>n>>a0;a=0.01*a0;for(int i=1;i<=n;i++){cin>>p[i].first>>p[i].second;}sort(p+1,p+n+1);double b=2e7;for(int i=1;i<=n;i++){for(int j=i+1;j<=n&&j<=i+6000;j++){b=min(b,calc(p[i].first,p[i].second,p[j].first,p[j].second));}}cout<<fixed<<setprecision(10)<<b<<"\n";}return 0;
}