Beautiful Strings CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

Beautiful Strings CodeChef Solution

Beautiful Strings CodeChef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Problem

Chef has � books such that the ��ℎ book has �� pages. He wants to divide all the books between Alice and Bob such that:

  • Both Alice and Bob get at least one book;
  • The number of pages allotted to Alice and Bob are either both odd or both even.

Find whether such distribution exists.

Input Format

  • The first line of input will contain a single integer �, denoting the number of test cases.
  • Each test case consists of multiple lines of input.
    • The first line of each test case contains a single integer � — the number of books.
    • The next line contains � space-separated integers, where the ��ℎ integer denotes the number of pages in the ��ℎ book.

Output Format

For each test case, output on a new line, YES, if a valid distribution exists. Otherwise, print NO.

You can print each character in uppercase or lowercase. For example, NO, no, No, and nO, are all considered the same.

Constraints

  • 1≤�≤100
  • 2≤�≤105
  • 1≤��≤100
  • The sum of � over all test cases won’t exceed 2â‹…105.

Sample 1:

Input

Output

3
3
2 4 6
4
1 1 2 3
6
3 1 1 1 1 1
YES
NO
YES

Explanation:

Test case 1: Consider the distribution where Alice gets books 1 and 3, and Bob gets the book 2. Thus, the number of pages allotted to Alice is 2+6=8, and the number of pages allotted to Bob is 4.
Thus, both Alice and Bob have even number of pages allotted to them.

Test case 2: It can be proven that there exists no valid distribution.

Test case 3: Consider the distribution where Alice gets the books 1,2, and 3, and Bob gets the books 4,5, and 6. Thus, the number of pages allotted to Alice is 3+1+1=5, and the number of pages allotted to Bob is 1+1+1=3.
Thus, both Alice and Bob have odd number of pages allotted to them.

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

SOLUTION

Here Discuss About Solve Beautiful Strings CodeChef Solution

SOLUTION

Beautiful Strings CodeChef Solution

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *