func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 300005;   int a[N], mx[N], ans[N];   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     vector<pair<int, int> > vec;     for (int i = 1; i <= n; i++) {       cin >> a[i];       vec.emplace_back(a[i], i);     }     memset(mx, 0, sizeof(mx));     sort(vec.begin(), vec.end());     ans[n - 1] = vec.back().first;     while (!vec.empty()) {       int i = vec.back().second;       vec.pop_back();       int len = min(i - 1, n - i);       mx[len] = max(mx[len], a[i]);     }     for (int i = n - 1; i >= 0; i--) {       mx[i] = max(mx[i], mx[i + 1]);     }     for (int i = n - 2; i >= 0; i -= 2) {       ans[i] = mx[(n - 2 - i) >> 1];     }     for (int i = 1; i < n; i++) {       vec.emplace_back(min(a[i], a[i + 1]), i);     }     memset(mx, 0, sizeof(mx));     sort(vec.begin(), vec.end());     while (!vec.empty()) {       int i = vec.back().second;       vec.pop_back();       int len = min(i - 1, n - 1 - i);       mx[len] = max(mx[len], min(a[i], a[i + 1]));     }     for (int i = n - 1; i >= 0; i--) {       mx[i] = max(mx[i], mx[i + 1]);     }     for (int i = n - 3; i >= 0; i -= 2) {       ans[i] = mx[(n - 3 - i) >> 1];     }     for (int i = 0; i < n; i++) {       cout << ans[i] <<    ;     }     cout <<   n ;     return 0;   }   