[Solution] Equal Distinct CodeChef Solution
Problem
Let denote the number of distinct elements in the array . For example,
You are given an array containing integers. Find if it is possible to divide the elements of the array into two arrays and such that :
- Every element of the array belongs either to array or to array .
- .
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two lines of input.
- The first line of each test case contains an integer — the length of the array .
- The next line contains space-separated integer , denoting the elements of the array .
Output Format
For each test case, print YES
if it is possible to divide the elements of the array into two arrays satisfying all the conditions and NO
otherwise.
You may print each character of the string in either uppercase or lowercase (for example, the strings yEs
, yes
, Yes
, and YES
will all be treated as identical).
Explanation:
Test case : One possible division is . Here
Test case : There is no way to distribute the elements of the array satisfying all the conditions.
Test case : One possible division is . Here
No comments:
Post a Comment