#K53152. Distinct Costume Color Schemes
Distinct Costume Color Schemes
Distinct Costume Color Schemes
You are given a palette of (M) colors and a list of costumes. Each costume is represented as a list of (N) distinct integers, each identifying a color. Two costumes are considered to have the same color scheme if their lists, when sorted in ascending order, are identical. Your task is to determine whether all costumes have distinct color schemes. In other words, output Valid
if no two costumes share the same set of colors (order is irrelevant), otherwise output Invalid
.
Input Format:
- The first line contains two integers \(N\) and \(M\).
- The second line contains an integer \(K\), the number of costumes.
- The following \(K\) lines each contain \(N\) space-separated integers representing a costume.
Output Format:
- Output a single line:
Valid
if all costumes have distinct color schemes; otherwise,Invalid
.
inputFormat
The first line of the input contains two integers (N) and (M) separated by a space. The second line contains an integer (K) which denotes the number of costumes. This is followed by (K) lines, each containing (N) integers (separated by spaces) that represent a costume's colors.
outputFormat
Print a single line Valid
if every costume has a unique color scheme (after sorting), otherwise print Invalid
.## sample
2 4
4
1 2
3 4
2 3
4 1
Valid
</p>