600B.md (1081B)
1 Source: https://codeforces.com/problemset/problem/600/B 2 3 B. Queries about less or equal elements 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given two arrays of integers *a* and *b*. For each element of the second array *b**j* you should find the number of elements in array *a* that are less than or equal to the value *b**j*. 22 23 Input 24 25 The first line contains two integers *n*, *m* (1 ≤ *n*, *m* ≤ 2·105) — the sizes of arrays *a* and *b*. 26 27 The second line contains *n* integers — the elements of array *a* ( - 109 ≤ *a**i* ≤ 109). 28 29 The third line contains *m* integers — the elements of array *b* ( - 109 ≤ *b**j* ≤ 109). 30 31 Output 32 33 Print *m* integers, separated by spaces: the *j*-th of which is equal to the number of such elements in array *a* that are less than or equal to the value *b**j*. 34 35 Examples 36 37 Input 38 39 ``` 40 5 4 41 1 3 5 7 9 42 6 4 2 8 43 ``` 44 45 Output 46 47 ``` 48 3 2 1 4 49 ``` 50 51 Input 52 53 ``` 54 5 5 55 1 2 1 2 5 56 3 1 4 1 5 57 ``` 58 59 Output 60 61 ``` 62 4 2 4 2 5 63 ```