#K95857. Can Be Majority Element?

    ID: 38956 Type: Default 1000ms 256MiB

Can Be Majority Element?

Can Be Majority Element?

This problem asks you to determine if a given integer can be considered as a majority element in an array.

A majority element is defined as an element that appears strictly more than \(\frac{n}{2}\) times in an array of size \(n\). You are given \(T\) test cases, and for each test case you will be provided with an integer \(n\) representing the size of the array, an integer \(x\) to check, and an array of \(n\) integers. Your task is to output "Yes" if \(x\) appears more than \(\frac{n}{2}\) times in the array, and "No" otherwise.

inputFormat

The first line contains an integer (T), the number of test cases. For each test case, the first line contains two integers (n) and (x). The second line contains (n) space-separated integers representing the array. All input is provided via stdin.

outputFormat

For each test case, output a single line containing either "Yes" or "No". The output is printed to stdout.## sample

2
5 3
1 2 3 3 3
4 2
1 2 2 3
Yes

No

</p>