#K42982. Check Consecutive Numbers
Check Consecutive Numbers
Check Consecutive Numbers
You are given a list of integers. Your task is to determine if the list forms a consecutive series of unique integers. In other words, if the unique elements in the list have a minimum value \(m\) and a maximum value \(M\), then the list is consecutive if and only if the number of unique integers is equal to \(M - m + 1\). Otherwise, the sequence is not consecutive.
For example, given the list [1, 2, 3, 4, 5], since \(5 - 1 + 1 = 5\) equals the count of unique integers, it is consecutive. However, the list [1, 2, 4, 5, 6] is not consecutive because the count does not match \(6 - 1 + 1 = 6\).
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains an integer \(N\), representing the number of integers. The second line contains \(N\) space-separated integers.
Example:
5 1 2 3 4 5
outputFormat
Output a single line to standard output (stdout): "CONSECUTIVE" if the list of unique integers forms a consecutive sequence (i.e. if \(|unique| = max(unique) - min(unique) + 1\)); otherwise, output "NOT CONSECUTIVE".
## sample5
1 2 3 4 5
CONSECUTIVE