QOJ.ac

QOJ

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

#12378. 天天爱射击

Statistics

小 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
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.