#C681. Valid Playlist
Valid Playlist
Valid Playlist
This problem requires you to determine whether a playlist is valid. A playlist is valid if it meets two conditions:
- The playlist contains at least one song (i.e. \( M \ge 1 \)).
- No two consecutive songs are of the same genre.
You are given the number of songs \( M \), the number of unique genres \( G \), and a sequence of \( M \) integers where the \( i\)-th integer represents the genre of the \( i\)-th song. Although the value of \( G \) is provided, it is not used in the validation process.
Your task is to check these conditions and print "Valid" if they are met, otherwise print "Invalid".
inputFormat
The input is given via standard input (stdin) and consists of two lines:
- The first line contains two space-separated integers \( M \) and \( G \).
- The second line contains \( M \) space-separated integers representing the genres of the songs.
outputFormat
Output a single string to standard output (stdout): either "Valid" if the playlist meets the criteria, or "Invalid" otherwise.
## sample5 3
1 2 1 3 2
Valid