#include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; template struct Dijkstra{ const T inf=numeric_limits::max(); using P=pair; int n; vector>> g; vector d; Dijkstra(int n):n(n),g(n),d(n){} void add_edge(int u,int v,T w){ g[u].emplace_back(v,w); } vector build(int s){ for(int i=0;i,greater

> pq; pq.emplace(d[s],s); while(pq.size()){ P p=pq.top(); pq.pop(); int v=p.second; if(d[v]d[v]+c){ d[u]=d[v]+c; pq.emplace(d[u],u); } } } return d; } }; double dist(int x,int y,int xx,int yy){ return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy)); } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m,x,y; cin >> n >> m >> x >> y; x--; y--; vector p(n),q(n); for(int i=0;i> p[i] >> q[i]; } Dijkstra D(n); while(m--){ int a,b; cin >> a >> b; a--; b--; double d=dist(p[a],q[a],p[b],q[b]); D.add_edge(a,b,d); D.add_edge(b,a,d); } printf("%.9f\n",D.build(x)[y]); }