DatabricksOA #20
Lamps Illumination
估计中等可在线判题
Each lamp covers a closed interval [left,right] on the integer number line. Given several query points, output how many lamps illuminate each point.
Standard input/output and this site's supplementary ranges follow this problem's description.
输入格式
The first line contains m q (0≤m≤50000, 1≤q≤50000), followed by m lines giving left right (−10⁹≤left≤right≤10⁹); the last line gives the q query points (−10⁹≤point≤10⁹). The length limits are site supplements.
输出格式
One line with q integers giving the number of covering lamps for each query point in input order, separated by spaces.
样例 1
输入:
3 7
1 7
3 5
4 6
1 3 4 5 6 7 8
输出:
1 2 3 3 2 1 0
样例 2
输入:
0 3
-1 0 1
输出:
0 0 0
样例 3
输入:
3 5
-2 2
-2 -2
2 2
-3 -2 0 2 3
输出:
0 2 1 2 0