Choose From Two Arrays

0

0 votes
Easy
Problem

You are given 2 arrays sorted (not necessarily sorted).Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number in array B.

Input

The first line consists two integers na and nb , separated by a space - sizes of array A and B correspondingly.
The second line consists of two integers k and m respectively.
The third line contains na --- the elements of array A.
The fourth line contains nb --- the elements of array B.

Output

Print "YES" if you can choose k numbers from array A and m from array B such that the constraint is fulfilled.Print "NO" otherwise

Constraints

  • 1≤ na , nb ≤ 105
  • 1 ≤ k ≤ na , 1 ≤ m ≤ nb
  • -109 ≤ ai ≤ 109
  • -109 ≤ bi ≤ 109
Sample Input
3 3
2 1
1 2 3
3 4 5
Sample Output
YES
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

In the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).

Contributers:
Editor Image

?