func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2 * 100100;   int a[maxn], logTable[maxn], rmq[50][maxn];   int minPos(int i, int j) {     int k = logTable[j - i];     int x = rmq[k][i];     int y = rmq[k][j - (1 << k) + 1];     return a[x] <= a[y] ? a[x] : a[y];   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = 2; i <= n; i++) logTable[i] = logTable[i >> 1] + 1;     for (int i = 0; i < n; ++i) rmq[0][i] = i;     for (int k = 1; (1 << k) < n; ++k) {       for (int i = 0; i + (1 << k) <= n; i++) {         int x = rmq[k - 1][i];         int y = rmq[k - 1][i + (1 << (k - 1))];         rmq[k][i] = a[x] <= a[y] ? x : y;       }     }     set<pair<int, int> > s;     for (int i = 0; i < n; i++) {       int curr, curl;       int l = i, r = n;       while (r - l > 1) {         int mid = (r + l) / 2;         int curmin = minPos(i, mid);         if (curmin == a[i])           l = mid;         else           r = mid;       }       curr = l;       l = -1, r = i;       while (r - l > 1) {         int mid = (r + l) / 2;         int curmin = minPos(mid, i);         if (curmin == a[i])           r = mid;         else           l = mid;       }       curl = r;       s.insert(make_pair(-a[i], curr - curl + 1));     }     for (int i = 1; i <= n; i++) {       while ((int)(s).size() && s.begin()->second < i) s.erase(s.begin());       printf( %d  , -s.begin()->first);     }     return 0;   }   