func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[100100], id[100100], t, Ans, ans[100100], n, i, vis[100100], j, k;   int flag;   vector<int> vec[100100];   bool cmp(int u, int v) { return a[u] < a[v]; }   int main() {     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %d , &a[i]);       id[i] = i;     }     sort(id + 1, id + 1 + n, cmp);     vec[1].push_back(1);     if (n > 1) vec[1].push_back(n);     vis[1] = vis[n] = vis[0] = vis[n + 1] = 1;     ;     j = 1;     while (a[id[j]] == 1) {       if (vis[id[j]] == 0) {         vec[1].push_back(id[j]);         vis[id[j]] = 1;       }       j++;     }     for (i = 2; i <= n; i++) {       flag = 0;       while (a[id[j]] == i) {         if (vis[id[j]] == 0) {           vec[i].push_back(id[j]);           vis[id[j]] = 1;           flag = 1;         }         j++;       }       for (k = 0; k < vec[i - 1].size(); k++) {         t = vec[i - 1][k];         if (vis[t - 1] == 0) {           vis[t - 1] = 1;           vec[i].push_back(t - 1);           flag = 1;         }         if (vis[t + 1] == 0) {           vis[t + 1] = 1;           vec[i].push_back(t + 1);           flag = 1;         }       }       if (!flag) break;     }     printf( %d n , i - 1);   }   