5128: Arrays数组

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:12 通过:9

题目描述


    已知由整数组成的数组AB,按非递减顺序排序。检查是否可以在数组A中选择k个数字,在数组B中选择m个数字,使第一个数组中选择的任何数字都严格小于第二个数组中选择的任何数字。

You are given two arrays A and B consisting of integers, sorted in non-decreasing order. 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 chosen in the second array.

Input
The first line contains two integers nA,nB (1≤nA,nB≤105), separated by a space − the sizes of arrays A and B, correspondingly.
The second line contains two integers k and m (1≤knA,1≤mnB), separated by a space.
The third line contains nA numbers a1,a2,... anA (-109a1a2≤...≤anA≤109), separated by spaces − elements of array A.
The fourth line contains nB integers b1,b2,... bnB (-109b1b2≤...≤bnB≤109), separated by spaces − elements of array B.
Output
Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes).
Examples
Input
3 3
2 1
1 2 3
3 4 5
Output
YES
Input
3 3
3 3
1 2 3
3 4 5
Output
NO
Input
5 2
3 1
1 1 1 1 1
2 2
Output
YES
Note
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).
In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers chosen in A will be less than all the numbers chosen in B: .

输入格式

第一行包含两个整数nA,nB (1≤nA,nB≤105),以空格分隔,分别表示数组aB的大小。
第二行包含两个整数km (1≤knA,1≤mnB)被一个空格隔开。
第三行包含nA个数字a1,a2,... anA (-109a1a2≤...≤anA≤109),以空格分隔。
第四行包含nB个整数b1,b2,... bnB (-109b1b2≤...≤bnB≤109),以空格分隔。

输出格式

如果可以在数组A中选择k个数字,在数组B中选择m个数字,使数组A中选择的任何数字都严格小于数组B中选择的任何数字,则打印“YES”(不带引号)。否则,打印“NO”(不带引号)

输入样例 复制

3 3
2 1
1 2 3
3 4 5

输出样例 复制

YES

数据范围与提示

注意
例如,在第一个示例测试中,您可以从数组A中选择数字12,从数组B中选择数字3(1 < 32 < 3)
在第二个样本测试中,在第一个数组中选择k个元素,在第二个数组中选择m个元素的唯一方法是选择两个数组中的所有数字,但不是在A中选择的所有数字都小于在B中选择的所有数字