CF1032G.Chattering

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn parrots standing in a circle. Each parrot has a certain level of respect among other parrots, namely rir_i . When a parrot with respect level xx starts chattering, xx 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?

输入格式

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

In the next line of input there are nn integers r1r_1 , ..., rnr_n , the respect levels of parrots in order they stand in the circle ( 1rin1 \leq r_i \leq n ).

输出格式

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

输入输出样例

  • 输入#1

    4
    1 1 4 1
    

    输出#1

    2 2 1 2 
    
  • 输入#2

    8
    1 2 2 1 5 1 3 1
    

    输出#2

    3 3 2 2 1 2 2 3 
    
首页