func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 300005;   struct seg {     int v[N * 4], tp;     void build(int k, int l, int r, int *a) {       if (l == r) return v[k] = a[l], void(0);       int mid = (l + r) / 2;       build(k * 2, l, mid, a);       build(k * 2 + 1, mid + 1, r, a);       v[k] = (tp ? min(v[k * 2], v[k * 2 + 1]) : max(v[k * 2], v[k * 2 + 1]));     }     int ask(int k, int l, int r, int x, int y) {       if (l == x && r == y) return v[k];       int mid = (l + r) / 2;       if (y <= mid) return ask(k * 2, l, mid, x, y);       if (x > mid) return ask(k * 2 + 1, mid + 1, r, x, y);       return tp ? min(ask(k * 2, l, mid, x, mid),                       ask(k * 2 + 1, mid + 1, r, mid + 1, y))                 : max(ask(k * 2, l, mid, x, mid),                       ask(k * 2 + 1, mid + 1, r, mid + 1, y));     }   } mn[20], mx[20];   int r[N], n, id[N];   int L[20][N];   int R[20][N];   int main() {     scanf( %d , &n);     for (int i = (int)(1); i <= (int)(n); ++i)       scanf( %d , &r[i]), r[i + n] = r[i + n + n] = r[i];     for (int i = (int)(1); i <= (int)(3 * n); ++i)       L[0][i] = max(i - r[i], 1), R[0][i] = min(i + r[i], 3 * n);     for (int i = (int)(1); i <= (int)(18); ++i) {       mn[i - 1].tp = 1;       mx[i - 1].tp = 0;       mn[i - 1].build(1, 1, 3 * n, L[i - 1]);       mx[i - 1].build(1, 1, 3 * n, R[i - 1]);       for (int j = (int)(1); j <= (int)(3 * n); ++j) {         L[i][j] = mn[i - 1].ask(1, 1, 3 * n, L[i - 1][j], R[i - 1][j]);         R[i][j] = mx[i - 1].ask(1, 1, 3 * n, L[i - 1][j], R[i - 1][j]);       }     }     mn[18].tp = 1;     mx[18].tp = 0;     mn[18].build(1, 1, 3 * n, L[18]);     mx[18].build(1, 1, 3 * n, R[18]);     for (int i = (int)(1); i <= (int)(n); ++i) {       int l = n + i, r = n + i, ans = 0;       for (int j = (int)(18); j >= (int)(0); --j) {         int L = mn[j].ask(1, 1, 3 * n, l, r);         int R = mx[j].ask(1, 1, 3 * n, l, r);         if (R - L + 1 < n) l = L, r = R, ans += (1 << j);       }       printf( %d  , ans + ((r - l + 1) < n));     }   }   