[Solution] K-MEX CodeChef Solution | CodeChef Solution
You are given an array containing integers. Find if it is possible to choose exactly elements from the array such that the MEX of the chosen elements is exactly .
Recall that the MEX of an array is the smallest non-negative integer that does not belong to the array. For example, the MEX of is because does not belong to the array, the MEX of is because and belong to the array, but does not.
Input Format
- The first line contains an integer , denoting the number of test cases. The test cases then follow:
- The first line of each test case contains an integer , denoting the length of the array, the number of elements to be chosen, and the required MEX respectively.
- The second line of each test case contains space-separated integers , denoting
Enough Space CodeChef Solution
Chef Drinks Tea CodeChef Solution
High Accuracy CodeChef Solution
Xor Permutation CodeChef Solution
- the elements of the array.
Output Format
For each test case, print YES
if it is possible to choose elements from the array so that the MEX of the chosen elements is exactly and NO
otherwise.
You may print each character of the string in uppercase or lowercase (for example, the strings yEs
, yes
, Yes
and YES
will all be treated as identical).
No comments:
Post a Comment