Hide

Problem A
Permuted Arithmetic Sequence

An arithmetic sequence is a list of values where the difference between consecutive values is always the same. For example, 3,7,11,15 qualifies and so does 25,15,5,5,15. However 2,4,7 and 3,6,9,6 are not arithmetic sequences.

Input

Input begins with an integer, 1n100, on a line by itself. Following this are n lines, each describing a sequence. Each line begins with an integer, 3m100, giving the length of the sequence. This is followed by the m integer values that actually make up the sequence. Each of the sequence integers is in the range [106,106].

Output

For each sequence, output a line that says “arithmetic” if the sequence is an arithmetic sequence. Output “permuted arithmetic” if the sequence can be reordered to make an arithmetic sequence. Otherwise, output “non-arithmetic”.

Sample Input 1 Sample Output 1
3
5 1 2 3 4 5
3 20 6 13
4 5 9 15 19
arithmetic
permuted arithmetic
non-arithmetic
Hide

Please log in to submit a solution to this problem

Log in