#K69742. Longest Downward Trend of Meals

    ID: 33154 Type: Default 1000ms 256MiB

Longest Downward Trend of Meals

Longest Downward Trend of Meals

You are given T test cases. In each test case, you are given an integer N followed by a sequence of N integers. These integers represent the number of meals served on N consecutive days. A downward trend is defined as a period of consecutive days during which the number of meals strictly decreases from the previous day.

Your task is to calculate the length of the longest downward trend for each test case. The length of a downward trend is measured by the number of consecutive decreases (i.e. if the sequence is \(a_1, a_2, \dots, a_N\), then a downward trend occurs when \(a_{i} < a_{i-1}\)). If there is no period where the number of meals decreases consecutively, output "NO TREND".

Note: If N is less than 2 for a test case, there is no possibility for a trend.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. An integer T representing the number of test cases.
  2. For each test case:
    1. An integer N representing the number of days.
    2. A line containing N space-separated integers, where the \(i^{th}\) integer denotes the number of meals served on day \(i\).

outputFormat

For each test case, output a single line. If there exists a downward trend, the output should be the length of the longest downward trend (i.e. the maximum number of consecutive days with a strictly decreasing number of meals). If there is no such trend, output NO TREND.

The result for each test case should be printed to standard output (stdout).

## sample
3
7
10 9 8 7 11 6 5
5
5 4 4 3 2
4
2 2 2 2
3

2 NO TREND

</p>