func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void read(int &x) {     x = 0;     char c = getchar();     int f = 1;     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     x *= f;   }   const int N = 505000;   int n, a[N], ans[N];   int main() {     read(n);     for (int i = 1; i <= n; i++) read(a[i]);     for (int i = 0; i <= n - 2; i++) {       if ((n - i) & 1)         ans[i] = max(min(a[(1 + n - i) / 2],                          max(a[(1 + n - i) / 2 + 1], a[(1 + n - i) / 2 - 1])),                      min(a[(1 + n + i) / 2],                          max(a[(1 + n + i) / 2 + 1], a[(1 + n + i) / 2 - 1])));       else         ans[i] = max(a[(n - i + 1) / 2], a[(n + i + 2) / 2]);       if ((n & 1) && i == 1) ans[i] = max(ans[i], a[n / 2 + 1]);       if (i - 2 >= 0) ans[i] = max(ans[i], ans[i - 2]);     }     for (int i = 1; i <= n; i++) ans[n - 1] = max(ans[n - 1], a[i]);     for (int i = 0; i <= n - 1; i++) printf( %d  , ans[i]);     return 0;   }   