//#define _GLIBCXX_DEBUG #include using namespace std; using ll = long long; #define pp pair #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define ld long double #define al(a) (a).begin(),(a).end() #define mk make_pair #define check cout<<"?"<>n>>m; int x,y; cin>>x>>y; x--; y--; vector pos(n); vector>> path(n); rep(i,n){ int p,q; cin>>p>>q; pos[i]=mk(p,q); } rep(i,m){ int p,q; cin>>p>>q; p--; q--; ld dis=0; dis+=(pos[p].first-pos[q].first)*(pos[p].first-pos[q].first); dis+=(pos[p].second-pos[q].second)*(pos[p].second-pos[q].second); dis=sqrt(dis); path[p].push_back(mk(q,dis)); path[q].push_back(mk(p,dis)); } vector d(n,inf); d[x]=0; priority_queue, vector>, greater>> pq; pq.push(mk(0.0,x)); //cost,s # int s,to; ld cost,w; while(!(pq.empty())){ tie(cost,s)=pq.top(); pq.pop(); if(d[s]!=cost) continue; for(auto p:path[s]){ tie(to,w)=p; //# if(d[to]>d[s]+w){ d[to]=d[s]+w; pq.push(mk(d[to],to)); } } } cout<