#K8421. Photo Album Organization
Photo Album Organization
Photo Album Organization
You are given a photo collection consisting of n photos, each with an associated tag. John's goal is to organize these photos into a photo album. The organization rule is as follows: if there are at least \(k \times s\) distinct tags available among the photos, then the album can be organized, otherwise it cannot.
More formally, for each test case you are given three integers n, k, and s and a list of n integers representing the tags of the photos. Let \(U\) be the set of unique tags in the list. The answer for the test case is:
[
\text{Answer} = \begin{cases}
YES, & \text{if } |U| \ge k \times s
NO, & \text{otherwise}
\end{cases}
]
Output YES
if the album can be organized, or NO
otherwise.
inputFormat
The first line contains an integer T, the number of test cases. For each test case, the input is given in two lines:
- The first line contains three integers: n (number of photos), k, and s.
- The second line contains n integers, representing the tags of the photos.
All input is read from standard input (stdin).
outputFormat
For each test case, output one line containing either YES
or NO
as the result. The output is written to standard output (stdout).
2
9 3 3
1 2 3 4 5 6 7 8 9
6 2 3
1 1 2 2 3 3
YES
NO
</p>