Technocup 2019 - Elimination Round 3
G
Chattering
Codeforces
2900
原题
← F→
翻译中…

There are $n$ parrots standing in a circle. Each parrot has a certain level of respect among other parrots, namely $r_i$. When a parrot with respect level $x$ starts chattering, $x$ neighbours to the right and to the left of it start repeating the same words in 1 second. Their neighbours then start repeating as well, and so on, until all the birds begin to chatter.

翻译中…

You are given the respect levels of all parrots. For each parrot answer a question: if this certain parrot starts chattering, how many seconds will pass until all other birds will start repeating it?

翻译中…

Input

翻译中…

In the first line of input there is a single integer $n$, the number of parrots ($1 \leq n \leq 10^5$).

翻译中…

In the next line of input there are $n$ integers $r_1$, ..., $r_n$, the respect levels of parrots in order they stand in the circle ($1 \leq r_i \leq n$).

翻译中…

Output

翻译中…

Print $n$ integers. $i$-th of them should equal the number of seconds that is needed for all parrots to start chattering if the $i$-th parrot is the first to start.

翻译中…

样例

Input #1
4
1 1 4 1
Output #1
2 2 1 2
InputCopy OutputCopy
Input #2
8
1 2 2 1 5 1 3 1
Output #2
3 3 2 2 1 2 2 3
InputCopy OutputCopy
题目信息
题号
1032G
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。