/** * @FileName b.cpp * @Author kanpurin * @Created 2020.05.29 21:50:20 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; // dijkstra O(ElogV) // verify : https://onlinejudge.u-aizu.ac.jp/problems/GRL_1_A // ※拡張ダイクストラ template struct Dijkstra { private: int V; struct edge { int to; T cost; }; vector> G; public: const T inf = numeric_limits::max(); // s から i の最小コスト // 経路がない場合は inf vector d; // (頂点) ※ Dijkstra(int V) : V(V) { G.resize(V); } // 辺の追加 // 有向の場合 directed = true void add_edge(int from, int to, T weight, bool directed = false) { G[from].push_back({to,weight}); if (!directed) G[to].push_back({from,weight}); } void build(int s) { d.assign(V, inf); // ※ typedef tuple P; //(距離,頂点) ※ priority_queue, greater

> pq; d[s] = 0; // ※ pq.push(P(d[s], s)); // ※ while (!pq.empty()) { P p = pq.top(); pq.pop(); int v = get<1>(p); // ※ if (d[v] < get<0>(p)) continue; // ※ for (const edge &e : G[v]) { // ※ if (d[e.to] > d[v] + e.cost) { d[e.to] = d[v] + e.cost; pq.push(P(d[e.to], e.to)); } } } } }; int main() { int n,m;cin >> n >> m; int s,t;cin >> s >> t; s--;t--; Dijkstra g(n); vector> p(n); for (int i = 0; i < n; i++) { cin >> p[i].first >> p[i].second; } for (int i = 0; i < m; i++) { int u,v;cin >> u >> v; u--;v--; g.add_edge(u,v,sqrt((p[u].first-p[v].first)*(p[u].first-p[v].first)+(p[u].second-p[v].second)*(p[u].second-p[v].second))); } g.build(s); printf("%.10f\n",g.d[t]); return 0; }