#60Medium
Order of sequences
Time: 1 s · Memory: 256 MB
- Nested loops
Statement
You are given sequences of numbers. For each of them determine whether it is strictly increasing (every next number is greater than the previous one), strictly decreasing (every next one is smaller), or neither.
Input format
The first line contains (). Each of the next lines starts with () — the length of the sequence, followed by integers ().
Output format
lines: 1 if the sequence increases, -1 if it decreases, otherwise 0.
Examples
Input
3 4 2 3 5 7 3 7 1 0 3 1 3 2
Output
1 -1 0
Input
1 2 5 5
Output
0
Note
The outer loop goes over the sequences, the inner loop compares neighbouring numbers. Two flags (increasing, decreasing) are enough. Equal neighbours make a sequence neither increasing nor decreasing: for 5 5 the answer is 0.
