# 礼国庆 2017 Day6」Star Way To Heaven

1

10 5 2
1 1
2 3


1.11803399


# 题解&分析

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
#define ll long long
const int MAXN = 6003;
double n , m;
int K;
bool vis[MAXN];
double dis[MAXN] , X[MAXN] , Y[MAXN];
int main()
{
scanf( "%lf%lf%d" , &n , &m , &K );
for( int i = 1 ; i <= K ; i ++ ){
scanf( "%lf%lf" , &X[i] , &Y[i] );
dis[i] = Y[i];
}
dis[K+1] = m;
dis[0] = 0x7f7f7f7f7f;
double ans = 0;
while( 1 ){
int tot = 0;
for( int i = 1 ; i <= K + 1 ; i ++ ){
if( dis[tot] > dis[i] && vis[i] == 0 ){
tot = i;
}
}
vis[tot] = 1;
ans = max( ans , dis[tot] );
dis[tot] = 0;
if( tot == K + 1 ){
printf( "%.9lf\n" , ans / 2.0 );
return 0 ;
}
for( int i = 1 ; i <= K ; i ++ ){
if( dis[tot] + sqrt( ( X[tot] - X[i] ) * ( X[tot] - X[i] ) * 1.0 + ( Y[tot] - Y[i] ) * ( Y[tot] - Y[i] ) * 1.0 ) < dis[i] && vis[i] == 0 )
dis[i] = dis[tot] + sqrt( ( X[tot] - X[i] ) * ( X[tot] - X[i] ) * 1.0 + ( Y[tot] - Y[i] ) * ( Y[tot] - Y[i] ) * 1.0 );
}
dis[K+1] = min( dis[K+1] , m - Y[tot] );
}
return 0;
}


10-30
08-17 53

10-28 116
08-09 21
01-19 30