[Solution] Group Assignment CodeChef Solution
Chef is hosting a party at his house and people are invited to it. Everyone has arrived and they are eager to make a group and chit-chat.
The person prefers to be in a group of exactly people (including himself). A person who is not in a group of preferred size gets upset. Find whether Chef would be able to assign every person to a group such that everyone remains happy.
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 an integer — the number of people at the party.
- The next line contains the array — where denotes the preferred group size
- for person.
Output Format
For each test case, output YES
, if Chef can assign every person to a group such that everyone remains happy. Otherwise output NO
.
Counting Words CodeChef Solution
MATH1 Enrolment CodeChef Solution
Group Assignment CodeChef Solution
Army Training CodeChef Solution
Sort the String CodeChef Solution
Vowel Anxiety CodeChef Solution
Array sorting CodeChef Solution
The output is case-insensitive, meaning that outputs such as yES
, YeS
, YES
and yes
mean the same.
Constraints
- Sum of over all test cases does not exceed
No comments:
Post a Comment