#include #define rep(i, n) for (int i = 0; i < (int) n; i++) using ll = long long; using namespace std; using T = tuple; using P = pair; const long long INF = 1ll << 60; template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { ll n, m, s, t; cin >> n >> m >> s >> t; s--; t--; vector p(n); rep(i, n) cin >> p[i]; vector> vertex(n); rep(i, m) { ll a, b; cin >> a >> b; a--; b--; vertex[a].push_back(b); vertex[b].push_back(a); } ll ans = 0; ll x = p[s]; set st; priority_queue

pri; st.insert(s); pri.emplace(p[s], s); while (!pri.empty()) { auto[pi, i] = pri.top(); pri.pop(); if (x > pi) { ans++; x = p[i]; } for (auto j:vertex[i]) { if (st.find(j) == st.end()) { st.insert(j); pri.emplace(p[j], j); } } } cout << ans << endl; }