#C4101. Consistent Genre Colors
Consistent Genre Colors
Consistent Genre Colors
You are given \(G\) genres and \(N\) books. Each genre has an initially assigned color code provided as an array of \(G\) integers. Each of the \(N\) books belongs to a genre and displays a current color code.
Your task is to determine whether the color code displayed on every book is consistent with the initial color assignment for its genre. In other words, for a book belonging to genre \(i\), its displayed color must equal the \(i^{th}\) element in the initial color list.
If all books are consistent, output "CONSISTENT"; otherwise, output "INCONSISTENT".
inputFormat
The first line of input contains two integers \(G\) and \(N\), representing the number of genres and the number of books respectively.
The second line contains \(G\) integers representing the initial color codes for the genres.
The next \(N\) lines each contain two integers: the first integer is the genre of a book and the second integer is its current color code.
All input is read from stdin
.
outputFormat
Output a single line to stdout
containing the string "CONSISTENT" if every book's current color matches the initially assigned color for its genre, or "INCONSISTENT" otherwise.
3 5
1 2 3
1 1
2 2
3 3
1 1
2 2
CONSISTENT