func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   int pa[maxn], a[maxn], b[maxn];   struct Edge {     int u, v, w;     friend bool operator<(const Edge& a, const Edge& b) { return a.w > b.w; }   } e[maxn];   void init(int n) {     for (int i = 1; i <= n; i++) pa[i] = i, b[i] = 1;   }   int find(int x) {     if (x == pa[x]) return x;     return pa[x] = find(pa[x]);   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     init(n);     for (int i = 1; i <= m; i++) {       scanf( %d%d , &e[i].u, &e[i].v);       e[i].w = min(a[e[i].u], a[e[i].v]);     }     sort(e + 1, e + m + 1);     double sum = 0;     for (int i = 1; i <= m; i++) {       int fu = find(e[i].u);       int fv = find(e[i].v);       if (fu != fv) {         sum += 1.0 * e[i].w * b[fu] * b[fv];         pa[fv] = fu;         b[fu] += b[fv];         b[fv] = 1;       }     }     printf( %.6f n , sum * 2 / (1.0 * n * (n - 1)));     return 0;   }   