#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-parameter" #include using namespace std; //#include //using namespace atcoder; //#define BOOST #ifdef BOOST #include #include using ml = boost::multiprecision::cpp_int; using md = boost::multiprecision::cpp_dec_float_100; #endif //#define LONG_LONG_INT #ifdef LONG_LONG_INT using ll = int; using ld = long double; const ll inf = 1000000000; #else using ll = long long; using ld = long double; const ll inf = 4000000000000000000; #endif /***** type *****/ using pll = pair; using pld = pair; template using vt = vector; template using vvt = vector>; using vll = vt; using vvll = vvt; using vld = vt; using vvld = vvt; using vch = vt; using vvch = vvt; using vstr = vt; using vvstr = vvt; using vpll = vt; using vvpll = vvt; using vpld = vt; using vvpld = vvt; using setll = set; using setpll = set; using setch = set; using setstr = set; using msetll = multiset; using msetld = multiset; using msetch = multiset; using msetstr = multiset; using mg = vt; using lg = vt; using wlg = vt; /***** define *****/ #define all(c) (c).begin(), (c).end() // begin to end #define allr(c) (c).rbegin(), (c).rend() // rbegin to rend #define coutld cout << fixed << setprecision(10) // cout double #define output(x) do { cout << x << endl; exit(0); } while(0) #define rep(i, b, e) for (ll i = b; i < e; i++) // repeat #define repr(i, b, e) for (ll i = b; e < i; i--) // repeat reverse #define fori(i, ...) if (ll i = -1) for(__VA_ARGS__) if (i++, 1) #define each(i, e, c) fori (i, auto&& e: c) // for each /***** const value *****/ const long long llong_max = 9223372036854775807; // 9 * 10^18 const long double pi = 3.1415926535897932; // 3.14 ... const long double eps = LDBL_EPSILON; // 2.22e-016 const size_t not_find = string::npos; // string::find() /***** lambda *****/ auto Bit = [] // bit test (auto x, auto i) { return ((x & (1LL << i)) != 0); }; auto Ceil = [] // if (a % b != 0) return a / b + 1; (auto x) { return (ll)ceil(x); }; auto Count = [] // long long count value (auto b, auto e, auto x) { return (ll)count(b, e, x); }; auto CtoL = [] // char to number (auto c) { return (ll)c - (ll)'0'; }; auto EQLD = [] // long double equal (auto a, auto b) { return fabsl(a - b) < eps; }; auto LtoC = [] // number to char (auto n) { return (char)('0' + n); }; auto Pow2 = [] // long long pow2 (auto n) { return (1LL << n); }; auto Size = [] // long long collection size (auto& c) { return (ll)(c).size(); }; /***** function *****/ template pair operator + (pair l, pair r) { // pair + pair return { l.first + r.first, l.second + r.second }; } template pair operator - (pair l, pair r) { // pair - pair return { l.first - r.first, l.second - r.second }; } template void MakeV2 (ll zs, ll ys, vvt& v, T fill = T()) { // vector> resize + fill v.resize(zs); rep(z, 0, zs) v[z].resize(ys, fill); } template void InputV2 (ll ys, ll xs, vvt& v, T fix = T()) { // input vector> (T != struct) + fix MakeV2(ys, xs, v, fix); rep(y, 0, ys) rep(x, 0, xs) cin >> v[y][x], v[y][x] += fix; } void InputGraph(ll v, mg& g, ll vfix) { // input adjacency matrix MakeV2(v, v, g, inf); rep(i, 0, v) rep(j, 0, v) cin >> g[i][j]; } void InputGraph(ll v, ll e, lg& g, ll vfix) { // input adjacency list g.resize(v); rep(i, 0, e) { ll a, b; cin >> a >> b; a += vfix, b += vfix; g[a].push_back(b), g[b].push_back(a); } } void InputGraph(ll v, ll e, wlg& g, ll vfix) { // input weighted adjacency list g.resize(v); rep(i, 0, e) { ll a, b, w; cin >> a >> b >> w; a += vfix, b += vfix; g[a].push_back({ b,w }), g[b].push_back({ a,w }); } } void InputDigraph(ll v, ll e, lg& g, ll vfix) { // input directed adjacency list g.resize(v); rep(i, 0, e) { ll a, b; cin >> a >> b; a += vfix, b += vfix; g[a].push_back(b); } } void InputDigraph(ll v, ll e, wlg& g, ll vfix) { // input weighted directed adjacency list g.resize(v); rep(i, 0, e) { ll a, b, w; cin >> a >> b >> w; a += vfix, b += vfix; g[a].push_back({ b,w }); } } template bool Range(ll x, T& v) { // x range size if (x < 0 || ll(v.size()) <= x) return false; return true; } template bool Range(ll y, ll x, T& v) { // yx range size if (y < 0 || ll(v.size()) <= y) return false; if (x < 0 || ll(v[y].size()) <= x) return false; return true; } template T Pow(T x, T n, bool over = false) { // template Pow(x, n) T res = 1; if (0 < n) { res = Pow(x, n / 2); res = res * res; if (n % 2 != 0) res *= x; if (over && inf < res) return inf; } return res; } ll Powll(ll x, ll n, bool over = false) { // long long Pow(x, n) ll res = 1; if (0 < n) { res = Pow(x, n / 2); res = res * res; if (n % 2 != 0) res *= x; if (over && inf < res) return inf; } return res; } /***************************************/ /********** BEGIN OF NYAA LIB **********/ /***************************************/ namespace NyaaGadget {} namespace NyaaGadget { /*** K-th ダイクストラ法ライブラリ O((V+E)logV) ***/ struct DijkstraResult { using ll = long long; using ld = long double; std::vector prev_vtx; // v->t遷移 pre_vtx[t] = v //std::vector min_cost; // s->v最短経路コスト min_cost[v] = c std::vector min_cost; // s->v最短経路コスト min_cost[v] = c std::vector GetPath(ll s, ll t) { // s-t最短経路の復元、復元不能なら空のvectorを返す std::vector path; for (ll v = t; v != -1 && v != s; v = prev_vtx[v]) { path.push_back(v); if (prev_vtx[v] == -1) path.clear(); if (prev_vtx[v] == s) path.push_back(s); } std::reverse(path.begin(), path.end()); return path; } }; struct GT_NyaaKthDijkstra { // 重み付き隣接リストを入力とする using ll = long long; //using pll = std::pair; using pld = std::pair; //using GRAPH = std::vector>; using GRAPH = std::vector>>; ll k; ll inf; GRAPH g; std::vector res; GT_NyaaKthDijkstra(GRAPH& g, ll inf, ll k) : k(k), inf(inf), g(g) { // 存在しない最短コストはinfで返す res.resize(k); for (ll i = 0; i < k; i++) { res[i].prev_vtx.resize(g.size(), -1); res[i].min_cost.resize(g.size(), inf); } } decltype(res)& Run(ll s, ll init) { // sからの最短経路を処理 //std::priority_queue, std::greater> pq; std::priority_queue, std::greater> pq; res[0].min_cost[s] = init, pq.push({ 0, s }); while (!pq.empty()) { // priority_queueで小さいコストから優先して取り出す auto [vcost, v] = pq.top(); pq.pop(); if (res.back().min_cost[v] < vcost) continue; for (auto [t, ecost] : g[v]) { //ll dk = vcost + ecost; ld dk = vcost + ecost; if (res[0].min_cost[t] > dk) { swap(res[0].min_cost[t], dk); res[0].prev_vtx[t] = v; pq.push({ res[0].min_cost[t], t }); } for (ll i = 0; i < k - 1; i++) { if (dk < res[i + 1].min_cost[v] && res[i].min_cost[v] < dk) { swap(res[i + 1].min_cost[t], dk); res[i + 1].prev_vtx[t] = v; pq.push({ res[i + 1].min_cost[t], t }); } } } } return res; } }; } /***************************************/ /*********** END OF NYAA LIB ***********/ /***************************************/ using namespace NyaaGadget; //using mll = NT_NyaaModLL< 1000000007 >; //using mll = NT_NyaaModLL< 998244353 >; int main() { ll N, M, K; cin >> N >> M >> K; ll X, Y; cin >> X >> Y, X--, Y--; vpll pq(N); each(i, e, pq) cin >> e.first >> e.second; vpll PQ(M); each(i, e, PQ) cin >> e.first >> e.second, e.first--, e.second--; using G = std::vector>>; G g(N); each(i, e, PQ) { g[e.first].push_back({ e.second, hypot(pq[e.second].first - pq[e.first].first, pq[e.second].second - pq[e.first].first) }); g[e.second].push_back({ e.first, hypot(pq[e.second].first - pq[e.first].first, pq[e.second].second - pq[e.first].first) }); } GT_NyaaKthDijkstra kd(g, inf, K); auto res = kd.Run(X, 0); rep(i, 0, K) coutld << res[i].min_cost[Y] << endl; return 0; }