Prom Night
Practice
4.1 (158 votes)
Algorithms
Approved
Easy
Implementation
Open
Sorting
Two Pointer
Problem
62% Success 32797 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
The Hexagon University of India will be hosting its Prom Night tonight.There would be M boys and N girls at the prom tonight. Each boy wants 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 get 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 get a girl else print NO.
Constraints:
1<=T<=10
1<=N, M<=10000
1<=Height<=200
Submissions
Please login to view your submissions
Similar Problems
Points:20
17 votes
Tags:
AlgorithmsQuick SortSorting
Points:20
65 votes
Tags:
ApprovedEasySorting
Points:20
272 votes
Tags:
Binary SearchEasyOpenSorting
Editorial