#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } constexpr long long MAX = 5100000; constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; //constexpr long long mod = 1000000007LL; constexpr long long mod = 998244353LL; const long double PI = acos((long double)(-1)); using namespace std; typedef unsigned long long ull; typedef long long ll; vector dijkstra(int start, vector>>& graph) { vector dist(graph.size(), INF); dist[start] = 0; priority_queue, vector>, greater>> pq; pq.emplace(0, start); while (!pq.empty()) { double cost; int idx; tie(cost, idx) = pq.top(); pq.pop(); if (dist[idx] < cost) continue; for (auto next : graph[idx]) if (chmin(dist[next.first], cost + next.second)) pq.emplace(dist[next.first], next.first); } return dist; } using P = pair; double dist(P a, P b) { double dx = a.first - b.first; double dy = a.second - b.second; return sqrt(dx * dx + dy * dy); } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ int n, m; scanf("%d %d", &n, &m); int x, y; scanf("%d %d", &x, &y); x--; y--; vector>> g(n); vector

vp(n); for (int i = 0; i < n; i++) scanf("%d %d", &vp[i].first, &vp[i].second); for (int i = 0; i < m; i++) { int u, v; scanf("%d %d", &u, &v); u--; v--; g[u].emplace_back(v, dist(vp[u], vp[v])); g[v].emplace_back(u, dist(vp[u], vp[v])); } auto dist = dijkstra(x, g); cout << fixed << setprecision(12) << dist[y] << endl; return 0; }