func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   T gi() {     T x = 0;     bool f = 0;     char c = getchar();     while (c !=  -  && (c <  0  || c >  9 )) c = getchar();     if (c ==  - ) f = 1, c = getchar();     while (c >=  0  && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return f ? -x : x;   }   const int N = 2e5 + 10;   struct node {     int to, nxt, w;   } g[N << 1];   int lst[N], gl, w[N];   void add(int z, int y, int x) {     g[++gl] = (node){y, lst[x], z};     lst[x] = gl;     g[++gl] = (node){x, lst[y], z};     lst[y] = gl;   }   int ans1;   double ans2;   int siz[N], mx, rt, sum;   bool vis[N];   void getroot(int u, int ff) {     siz[u] = 1;     int s = 0;     for (int i = lst[u]; i; i = g[i].nxt) {       int v = g[i].to;       if (v == ff || vis[v]) continue;       getroot(v, u);       siz[u] += siz[v];       s = max(s, siz[v]);     }     s = max(s, sum - siz[u]);     if (s < mx) mx = s, rt = u;   }   double sd[N], sumd, ans;   void dfs(int u, int ff, int tp, int dep) {     ans += pow(dep, 1.5) * w[u];     sumd += 1.5 * sqrt(dep) * w[u];     sd[tp] += 1.5 * sqrt(dep) * w[u];     for (int i = lst[u]; i; i = g[i].nxt) {       int v = g[i].to;       if (v == ff) continue;       dfs(v, u, tp, dep + g[i].w);     }   }   void solve(int u) {     vis[u] = 1;     ans = sumd = 0;     for (int i = lst[u]; i; i = g[i].nxt)       sd[g[i].to] = 0, dfs(g[i].to, u, g[i].to, g[i].w);     if (ans2 > ans) ans1 = u, ans2 = ans;     for (int i = lst[u]; i; i = g[i].nxt) {       int v = g[i].to;       if (vis[v]) continue;       if (sumd - sd[v] > sd[v]) continue;       mx = sum = siz[v];       getroot(v, u);       solve(rt);     }   }   int main() {     int n = gi<int>();     for (int i = 1; i <= n; i++) w[i] = gi<int>();     for (int i = 1; i < n; i++) add(gi<int>(), gi<int>(), gi<int>());     ans2 = 1e20;     mx = sum = n;     getroot(1, 0);     solve(rt);     printf( %d %.10lf n , ans1, ans2);     return 0;   }   