#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MOD (long long int)(1e9+7) #define ll long long int #define rep(i,n) for(int i=0; i<(int)(n); i++) #define reps(i,n) for(int i=1; i<=(int)(n); i++) #define REP(i,n) for(int i=n-1; i>=0; i--) #define REPS(i,n) for(int i=n; i>0; i--) #define INF (int)(1123456789) #define LINF (long long int)(112345678901234567) #define MAX_V 200005 //lower_bound使え struct edge{int to; double cost;}; typedef pair P;//最短距離、頂点番号 int V; vector G[MAX_V]; double d[MAX_V]; void dijkstra(int s){ priority_queue, greater

> que; fill(d,d+V,LINF); d[s] = 0; que.push(P(0,s)); while(!que.empty()){ P p = que.top(); que.pop(); int v = p.second; if(d[v] < p.first) continue; rep(i, G[v].size()){ edge e = G[v][i]; if(d[e.to] > d[v] + e.cost){ d[e.to] = d[v] + e.cost; que.push(P(d[e.to], e.to)); } } } } /* * 頂点数をVに代入すること */ int main(void){ cout<>n>>m; V=n; int s,t;cin>>s>>t;s--;t--; vector X,Y; rep(i,n){ int p,q;cin>>p>>q; X.push_back(p); Y.push_back(q); } rep(i,m){ int p,q;cin>>p>>q; p--;q--; double dist = sqrt((X[p]-X[q]) * (X[p]-X[q]) + (Y[p]-Y[q]) * (Y[p]-Y[q])); G[p].push_back({q,dist}); G[q].push_back({p,dist}); } dijkstra(s); cout << d[t] << endl; return 0; }