Question: Please use C++. 9.2 Programming Assignment #2 Sorting Riverfield Country Day School will be hosting its Prom Night tonight.There would be M boys and N

Please use C++.

9.2 Programming Assignment #2

Sorting

Riverfield Country Day School will be hosting its Prom Night tonight.There would be M boys and N girls at the prom tonight. Each boy wants to dance with a girl who is strictly shorter than him. A girl can dance with only one boy and vice-versa. Given the heights of all the boys and girls tell whether it is possible for all boys to dance with a girl.

Input: The first line contains T denoting the number of test cases. Each test case contains three lines. The first line contains M and N. The second line contains M integers each denoting the height of boy. The third contains N integers each denoting the height of girl.

Output: Print YES if it is possible for each boy to dance with a girl else print NO.

Sample input:

1 4 5 2 5 6 8 3 8 5 1 7 

Output from sample input:

YES

Default Template:

#include using namespace std;

int main() {

/* Type your code here. */

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!