QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#12378. 天天爱射击

统计

小 C 爱上了一款名字叫做《天天爱射击》的游戏。如图所示,这个游戏有一些平行于 $x$ 轴的木板。现在有一些子弹,按顺序沿着 $y$ 轴方向向这些木板射去。第 $i$ 块木板被 $S_i$ 个子弹贯穿以后,就会碎掉消失。一个子弹可以贯穿其弹道上的全部木板,特别的,如果一个子弹触碰到木板的边缘,也视为贯穿木板。

小 C 现在知道了游戏中 $n$ 块木板位置,以及知道了 $m$ 个子弹射击位置。现在问你每个子弹射出去以后,有多少木板会碎掉?

problem_12378_1.png

输入格式

第一行两个整数 $n$ 和 $m$,表示木板数量和子弹数量。其中 $1 \le n,m \le 2 \times 10^{5}$。

接下来 $n$ 行,每行三个整数 $x_1,x_2,s$,表示每块木板的左端点 $x$ 坐标、右端点 $x$ 坐标,以及贯穿多少次会碎掉。其中保证 $1 \le x_1 \le x_2 \le 2 \times 10^{5}, 1 \le s \le 2 \times 10^{5}$。

接下来 $m$ 行,每行一个整数 $x$,表示每个子弹的 $x$ 坐标。子弹按照发射顺序给出。其中保证 $1 \le x \le 2 \times 10^{5}$。

输出格式

$m$ 行,每行一个整数。表示每颗子弹射出去后,有多少木板碎掉。

样例数据

样例 1 输入

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

样例 1 输出

1
2

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.