#K48747. Distinct Subsequences Partitioning

    ID: 28489 Type: Default 1000ms 256MiB

Distinct Subsequences Partitioning

Distinct Subsequences Partitioning

Given a sequence of integers and a target number \( X \), your task is to determine whether the sequence contains at least \( X \) distinct integers. In other words, let \( S \) be the set of unique elements in the sequence; you must check if \( |S| \geq X \). This problem challenges you to analyze the sequence and output "YES" if the condition holds, otherwise output "NO".

Input is read from standard input and output is printed to standard output.

inputFormat

The first line contains an integer ( T ) denoting the number of test cases. Each test case consists of two lines:

  1. The first line contains two space-separated integers ( n ) and ( X ), where ( n ) is the length of the sequence and ( X ) is the minimum required number of distinct integers.
  2. The second line contains ( n ) space-separated integers representing the sequence.

outputFormat

For each test case, print a single line containing either "YES" if the sequence has at least ( X ) distinct integers, or "NO" otherwise.## sample

3
5 3
1 2 2 1 3
4 2
4 4 4 4
6 4
1 2 3 4 4 4
YES

NO YES

</p>