#K39412. Sequence Classification
Sequence Classification
Sequence Classification
You are given several sequences of integers. Each sequence is provided on a single line, and begins with an integer n (the length of the sequence), followed by n integers. Your task is to classify each sequence into one of four categories as follows:
- chirp: if the sequence is strictly increasing, i.e. \(a_i < a_{i+1}\) for all valid \(i\).
- buzz: if the sequence is strictly decreasing, i.e. \(a_i > a_{i+1}\) for all valid \(i\).
- whistle: if all elements in the sequence are equal, i.e. \(a_1 = a_2 = \cdots = a_n\).
- unknown: if the sequence does not satisfy any of the above conditions.
For example, the sequence "5 1 2 3 4 5" is strictly increasing so it should be classified as chirp.
inputFormat
The input is given via stdin and has the following format:
T n a1 a2 ... an n a1 a2 ... an ...
Here, the first line contains a single integer T representing the number of sequences. Each of the following T lines describes one sequence. The first number in each line is an integer n (the number of elements in the sequence), followed by n space-separated integers.
outputFormat
For each sequence, print the classification on a new line to stdout. The classification is one of chirp
, buzz
, whistle
, or unknown
.
5
5 1 2 3 4 5
5 5 4 3 2 1
5 7 7 7 7 7
4 1 3 2 5
3 6 6 6
chirp
buzz
whistle
unknown
whistle
</p>