#include <cstdio>
#include <cmath>
#include <queue>
double min(double x,double y){return x<y?x:y;}
double max(double x,double y){return x>y?x:y;}
const int N=3050;
double g[N][N],dis[N],x[N],y[N],n,m;
int num,used[N];
double get(double x1,double y1,double x2,double y2)
{
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2;
}
void init()
{
scanf("%d%lf%lf",&num,&n,&m);
for(int i=1;i<=num;i++)
scanf("%lf%lf",x+i,y+i);
for(int i=1;i<=num;i++)
for(int j=i+1;j<=num;j++)
g[i][j]=g[j][i]=get(x[i],y[i],x[j],y[j]);
for(int i=1;i<=num;i++)
{
g[0][i]=g[i][0]=min(x[i]-1,m-y[i]);
g[i][num+1]=g[num+1][i]=min((n-x[i]),y[i]-1);
}
g[0][num+1]=g[num+1][0]=1e233;
dis[0]=0;
for(int i=1;i<=num+1;i++)
dis[i]=1e233;
}
void spfa()
{
std::queue <int > q;
q.push(0);
while(!q.empty())
{
int u=q.front();
q.pop();used[u]=0;
for(int i=1;i<=num+1;i++)
{
if(i==u) continue;
if(dis[i]>max(dis[u],g[u][i]))
{
dis[i]=max(dis[u],g[u][i]);
if(!used[i])
{
used[i]=1;
q.push(i);
}
}
}
}
}
int main()
{
init();
spfa();
printf("%.2lf",dis[num+1]);
return 0;
}
13007:拯救小云公主
最新推荐文章于 2024-09-03 18:29:17 发布