Given a sequence of n numbers compute the folowing :

the length of the longest sequence of decreasing numbers

the number of sequences that have this length

 

The first line of file decrease.in contains the number n 1<=n<=5,000 . Each

of N subsequent lines contains one number (1 <= each number<= 32767).

 

Print to the file decrease.out  two integers on a single line:

The length of the sequence , the number of sequences

 

decrease.in

 

5

780

710

760

690

630

 

decrease.out

 

4 2

 

Observation :

 

In counting the number of solutions, two potential solutions are considered

the same (and would only count as one solution) if they repeat the same

string of decreasing numbers, that is, if they "look the same" when the

successive numbers are compared. Thus, two different sequence could produce

the same string of decreasing numbers and be counted as only a single

solution.

It is guaranteed that the number of solutions will fit in a 32-bit unsigned

long.

 

Time of execution : 3 seconds