CF600B.Queries about less or equal elements

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

给你两个整数数组 aa 和 bb。对于第二个数组中的每个元素 bjb_j,你需要找出数组 aa 中小于或等于 bjb_j 的元素个数。

输入格式

The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b.

The second line contains n integers — the elements of array a ( - 109 ≤ a__i ≤ 109).

The third line contains m integers — the elements of array b ( - 109 ≤ b__j ≤ 109).

第一行包含两个整数 nn 和 mm(1≤n,m≤2⋅1051 \leq n, m \leq 2 \cdot 10^5)—— 分别为数组 aa 和 bb 的大小。

第二行包含 nn 个整数 —— 数组 aa 的元素(−109≤ai≤109-10^9 \leq a_i \leq 10^9)。

第三行包含 mm 个整数 —— 数组 bb 的元素(−109≤bj≤109-10^9 \leq b_j \leq 10^9)。

输出格式

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.

输出 m 个整数,以空格分隔:其中第 j 个整数等于数组 a 中小于或等于值 b__j 的元素个数。

输入输出样例

  • 输入#1

    5 4
    1 3 5 7 9
    6 4 2 8

    输出#1

    3 2 1 4
  • 输入#2

    5 5
    1 2 1 2 5
    3 1 4 1 5

    输出#2

    4 2 4 2 5

输入解题思路,AI测评打分。不知道怎么写?

首页