已知由整数组成的数组A和B,按非递减顺序排序。检查是否可以在数组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.
3 3 2 1 1 2 3 3 4 5
YES
3 3 3 3 1 2 3 3 4 5
NO
5 2 3 1 1 1 1 1 1 2 2
YES
3 3
2 1
1 2 3
3 4 5
YES