#C2726. Potion Scroll Consistency
Potion Scroll Consistency
Potion Scroll Consistency
You are given m potion scrolls. Each scroll contains a series of potion quantities. The scrolls are considered consistent if and only if:
- Every scroll has the same number of potion quantities.
- For every column
j
(i.e. the j-th potion in each scroll), the quantities do not decrease as you move from the first scroll to the last. In other words, if we denote the quantity in scrolli
and potion positionj
by \(a_{i,j}\), then for all \(2 \le i \le m\) it must hold that \(a_{i,j} \ge a_{i-1,j}\).
Your task is to determine whether the given potion scrolls are CONSISTENT or INCONSISTENT.
Note: The input and output should be handled via standard input (stdin) and standard output (stdout), respectively.
inputFormat
The input is provided via standard input. The first line contains a single integer m
representing the number of scrolls. This is followed by m
sections. Each section describes a scroll with two lines:
- The first line of a section contains an integer
n
representing the number of potions in that scroll. - The second line contains
n
space-separated integers representing the quantities of the potions.
It is guaranteed that m ≥ 1
and each scroll will have at least one potion quantity.
outputFormat
Output a single line containing either CONSISTENT or INCONSISTENT (without quotes) according to the properties described above.
## sample3
3
2 3 5
3
2 5 7
3
3 5 8
CONSISTENT