#K13326. Determine List Order
Determine List Order
Determine List Order
You are given a list of N integers. The task is to determine whether the list is strictly increasing, strictly decreasing, or neither.
A list is considered strictly increasing if every element is less than its following element, i.e. for all valid indices \( i \), the inequality \( a_i < a_{i+1} \) holds. Likewise, it is strictly decreasing if for all valid indices \( i \), we have \( a_i > a_{i+1} \). If neither condition is satisfied, the answer is NEITHER.
For example, given the list [1, 2, 3, 4]
the output should be INCREASING
whereas for the list [9, 7, 5, 3, 1]
the output must be DECREASING
.
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains a single integer N representing the number of elements in the list.
- The second line contains N space-separated integers.
outputFormat
Print a single line to standard output (stdout) with one of the following strings: INCREASING
, DECREASING
, or NEITHER
depending on the order of the list.
4
1 2 3 4
INCREASING