func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 300005;   int k, u, v, a[N], n;   long long ans, dp[N];   vector<int> G[N];   void dfs(int u, int v, int flag) {     dp[u] = a[u];     for (int i : G[u]) {       if (i != v) {         dfs(i, u, flag);         dp[u] += max(dp[i], 0ll);       }     }     if (flag)       ans = max(ans, dp[u]);     else if (dp[u] == ans)       dp[u] = 0, k++;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i];     }     for (int i = 1; i < n; i++) {       cin >> u >> v;       G[u].push_back(v);       G[v].push_back(u);     }     ans = -1e9;     dfs(1, 0, 1);     dfs(1, 0, 0);     cout << ans * k <<     << k;     return 0;   }   