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
int main() {
/* Type your code here. */
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started