Anita's Experiment

mehdi_ BACS Regional Programming...
Limits 1s, 512 MB

Little Anita is doing an experiment with herself. Everyday, depending on her mood, she determines a score, let's name it mood score. She gives positive integer score to happiness, negative score to sadness and zero to neutral emotion. Then she updates her day's score by adding the mood score with previous day's score and keeps a log.
In this problem you will be given an array of integers, S. S[i] will denote the score of i'th day.

Anita defines any i'th day special if, S[i-1] < S[i] and s[i] > S[i+1], for any valid i.

Given the array S, you have to find the maximum number of days between any two consecutive special days.


First line will contain an integer 0<T<=50 denoting the number of test cases.
Each test case will contain two lines. First line will contain 2<=N<=1000, the length of array S. Second line will contain N space separated integers, each of which has an absolute value <= 10^6.


Print the desired value. But, if every day (except the first day) has a score not less than its previous day, then you have to print allGoodDays. If every day has a score not more than its previous day, then you have to print allBadDays. However, if all the scores are equal you need to print neutral. If none of above, or you can't find at least two special days, print none. Check Sample for details.


1 2 2 3
3 2 2 2 1
1 1 1 1 1
1 2 3 3 3 2 1
1 2 3 2 1 2 3 1 0 5 4


3rd sample case: there are no special days here. Moreover, it is neither allGoodDays nor allBadDays. So the answer is none.

4th sample case: there are 3 special days in this case. They are, 3rd day with score 3, 7th day with score 3 and 10th day with score 5.
The number of days between 3rd and 7th day is 3. The number of days between 7th and 10th days is 2. Thus the desired answer is 3.


Login to submit.


78% Solution Ratio
dothecode111Earliest, Jul '17
habijabiFastest, 0.0s
DevvJewelLightest, 0 B
mdvirusShortest, 436B
Toph uses cookies. By continuing you agree to our Cookie Policy.