Hide

Problem G
Puppy Zoomies

/problems/puppyzommies/file/statement/en/img-0001.jpg
Puppies have been known to get the "zoomies", periods of time when they dash wildly back and forth. For this exercise a tape measure has been laid out along a stretch where Perky the puppy has been known to exhibit the zoomies. During a recent episode of the zoomies, a record was made of the points at which Perky turned around. Your task is to determine the maximum number of times that Perky ran monotonically increasing distances. (That means the distances either increase or stay the same, but do not decrease.)

Input

The first line contains a single positive integer less than 200 indicating the number of dashes Perky made. Each following line contains a position (in centimeters from 1 through 1000) on the tape measure at which Perky reversed direction. Assume Perky starts at the first listed position the tape.

Output

Print the maximum number of monotonically increasing distances Perky dashed prior to turning around. In Sample 1, Perky’s maximum increasing sequence is at the end with 3 increases of 50, 180, and 320 cm.

\includegraphics[width=\linewidth ]{Zoomies.jpg}

Sample Input 1 Sample Output 1
6
200
50
210
160
340
20
3
Sample Input 2 Sample Output 2
1
200
0

Please log in to submit a solution to this problem

Log in