528. Queries about less or equal elements
0
Easy
In a game, you are given two arrays `a` and `b` of sizes **N** and **M** respectively.
For each element `b[j]` in the second array `b`, you need to determine the number of elements in array `a` that are less than or equal to `b[j]`.
For each element `b[j]` in the second array `b`, you need to determine the number of elements in array `a` that are less than or equal to `b[j]`.
Input Format
The first line contains two space-separated integers, N and M.
The second line contains N space-separated integers representing the elements of array `a`.
The third line contains M space-separated integers representing the elements of array `b`.
The second line contains N space-separated integers representing the elements of array `a`.
The third line contains M space-separated integers representing the elements of array `b`.
Output Format
Print the number of elements in array `a` that are greater than or equal to each element `b[i]` for every i in the range [0, M].
Example
Input
5 4
1 3 5 7 9
6 4 2 8
Output
3 2 1 4
Constraints
1 <= N , M <= 2*10^5
-109 <= a[i] , b[i] <= 109
-109 <= a[i] , b[i] <= 109
Loading...
View Submissions
Console