#P7424. [THUPC 2017] 天天爱射击

    ID: 8291 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2017树状数组可持久化线段树可持久化分块整体二分THUPC

[THUPC 2017] 天天爱射击

Problem Description

Xiao C has fallen in love with a game called “Daily Shooting”. As shown in the figure, there are some wooden boards parallel to the xx axis in this game. Now there are some bullets, which are shot in order along the yy axis direction toward these boards. After the ii-th board is penetrated by SiS_i bullets, it will break and disappear. A bullet can penetrate all boards on its trajectory. In particular, if a bullet touches the edge of a board, it is also considered to have penetrated the board.

Xiao C now knows the positions of nn boards in the game, and also knows the shooting positions of mm bullets. You are asked: after each bullet is fired, how many boards will break?

Input Format

Read input from standard input.

The first line contains two integers nn and mm, representing the number of boards and the number of bullets. 1n,m2×1051\le n,m\le 2\times 10^5.

The next nn lines each contain three integers x1,x2,sx_1,x_2,s, representing the xx coordinate of the left endpoint, the xx coordinate of the right endpoint, and how many penetrations are needed for the board to break. It is guaranteed that 1x1x22×1051\le x_1\le x_2\le 2\times 10^5 and 1s2×1051\le s\le 2\times 10^5.

The next mm lines each contain one integer xx, representing the xx coordinate of each bullet. The bullets are given in firing order. It is guaranteed that 1x2×1051\le x\le 2\times 10^5.

Output Format

Write to standard output.

Output mm lines, each containing one integer, indicating how many boards break after each bullet is fired.

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

Hint

From THUPC (THU Programming Contest, Tsinghua University Programming Contest) 2017.

upd2021.7.6\text{upd}2021.7.6:Thanks to

https://www.luogu.com.cn/user/366807
tdata. It is not scored, but if you do not pass the hack testdata, you will not be considered to have passed this problem.

Translated by ChatGPT 5