Mental Change

TarifEzaz Criterion 2022 Round 18
Limits 1s, 512 MB

Anjan was feeling low for nearly a couple of months. To improve his condition, he decided to track his mental state using a policy. Based on his activity level and mood, he has assigned a non-negative integer sis_i for each day. He calls each values of sis_i the satisfaction index (SI) of day ii.

After generating the satisfaction index value for nn days, he went to a psychologist to improve his mental condition. The psychologist was pleased to see his data and gave him an exercise to further analyze his situation. Anjan needs to calculate another integer value called improvement index(II) for each of the n days using the following policy:

  1. The II of day 11 is 11.

  2. For i>1i >1, the II of day ii is 11 greater than day i1i-1 if the SI of day ii is strictly greater than si1s_{i-1}

  3. For i>1i >1, if SI of day ii less than or equal to the SI of day i1i-1, then the II of day ii is 11.

Despite the work being simple, Anjan felt a lot of stress and decided to take a vacation to Rangamati. He assigned you to calculate the nn values for him.


The first line of input contains an integer nn (0n1000 ≤ n ≤ 100), the number of days Anjan has kept track of his mental states. In the next nn lines there will be one integer sis_i ( 0si1090 ≤ s_i ≤ 10^9) each, the satisfaction index of day ii.


Output nn integers in one line, the improvement index of Anjan based on the data he generated.


1 2 1


Login to submit.


93% Solution Ratio
KarliverEarliest, 1w ago
user.360086Fastest, 0.0s
KarliverLightest, 131 kB
SabbasachiSutradharShortest, 168B
Toph uses cookies. By continuing you agree to our Cookie Policy.