又是一天的毒瘤题
辣鸡南瓜只会T1嘤嘤嘤
一个玄学最小生成树orz
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cmath>
#define maxn 12010
using namespace std;
const double inf=99999999.0;
bool vis[maxn];
int n,m,k,num,flag,fir[maxn<<1],pre[maxn];
double mmin,mini[maxn],maxi[maxn];
struct qvq
{
double x,y;
}star[maxn<<1];
struct qwq
{
int to,nxt;
double val;
}e[maxn];
int read()
{
int xx=0,kk=1;char ch=' ';
while(!isdigit(ch)){ch=getchar();if(ch=='-')kk=-1;}
while(isdigit(ch)){xx=xx*10+ch-'0';ch=getchar();}
return kk*xx;
}
double dis(int i,int j)
{
if(!i&&j==k+1) return 1.0*m;
if(!i) return star[j].y;
if(j==k+1) return 1.0*m-star[i].y;
return sqrt(pow(star[i].x-star[j].x,2)+pow(star[i].y-star[j].y,2));
}
void addedge(int u,int v,double w)
{
e[++num].to=v;
e[num].val=w;
e[num].nxt=fir[u];
fir[u]=num;
}
void prim(int s)
{
if(s==k+1) return;
vis[s]=true;mmin=inf;flag=0;
for(int i=1;i<=k+1;++i)
if(!vis[i]&&mini[i]>dis(s,i))
mini[i]=dis(s,i),pre[i]=s;
for(int i=1;i<=k+1;++i)
{
if(mini[i]<mmin&&!vis[i])
{
flag=i;mmin=mini[i];
}
}
if(!flag) return;
addedge(pre[flag],flag,mmin);
addedge(flag,pre[flag],mmin);
prim(flag);
}
void dfs(int u,int f)
{
for(int i=fir[u];i;i=e[i].nxt)
{
int v=e[i].to;
if(v==f) continue;
maxi[v]=max(maxi[u],e[i].val/2.0);
dfs(v,u);
}
}
int main()
{
freopen("starway.in","r",stdin);
freopen("starway.out","w",stdout);
n=read(),m=read(),k=read();
for(int i=1;i<=k;++i)
star[i].x=1.0*read(),star[i].y=1.0*read();
for(int i=1;i<=k+1;++i) mini[i]=inf;
prim(0);dfs(0,0);
printf("%.8lf",maxi[k+1]);
return 0;
}
/*
10 5 2
1 1
2 3
*/