func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int n, m;   vector<pair<long long, int> > v;   vector<int> u[N];   int vis[N];   void dfs(int s) {     if (!vis[s]) {       vis[s] = true;       for (int i = 0; i < u[s].size(); i++) {         dfs(u[s][i]);       }     }   }   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m;     long long cnt = 0;     memset(vis, 0, sizeof(vis));     long long x, y;     for (int i = 0; i < n; i++) {       cin >> x;       v.push_back(make_pair(x, i + 1));     }     for (int i = 0; i < m; i++) {       cin >> x >> y;       u[x].push_back(y);       u[y].push_back(x);     }     sort(v.begin(), v.end());     for (int i = 0; i < n; i++) {       if (!vis[v[i].second]) {         dfs(v[i].second);         cnt += v[i].first;       }     }     cout << cnt;     return 0;   }   