func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mm = 1000000007;   const long long inf = 1e18;   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   vector<int> e[6005];   int a[6005], q[6005], n, ans;   void dfs(int u, int top, int fa) {     int pos, tmp;     if (!top || a[u] > q[top]) {       pos = ++top;       tmp = q[top];       q[top] = a[u];       ans = max(ans, top);     } else {       pos = lower_bound(q + 1, q + 1 + top, a[u]) - q;       tmp = q[pos];       q[pos] = a[u];     }     for (int i = 0; i < (int)e[u].size(); i++) {       int v = e[u][i];       if (v == fa) continue;       dfs(v, top, u);     }     q[pos] = tmp;   }   int main() {     n = read();     for (int i = 1; i <= n; i++) a[i] = read();     for (int i = 1; i <= n - 1; i++) {       int x = read(), y = read();       e[x].push_back(y);       e[y].push_back(x);     }     for (int i = 1; i <= n; i++) dfs(i, 0, 0);     printf( %d n , ans);     return 0;   }   