题目链接:https://www.nowcoder.com/acm/contest/144/I
The input starts with one line containing exactly one integer T, which is the number of test cases.
For each test case, the first line contains two integers n and m, indicating the number of trains and the number of Team Rocket members.
Each of the next n lines contains 2 integers li and ri, indicating the driving range of the i-th train.
Each of the next m lines contains exactly one integer yi.
If no such trip exists, resi-1 is considered to be 0.
- 1 ≤ T ≤ 5.
- 1 ≤ n,m ≤ 2 x 105.
- -109 ≤ li ≤ ri ≤ 109.
- -109 ≤ xi ≤ 109.
For each test case, output one line "Case #x:" first, where x is the test case number (starting from 1).
Then output m lines, each line of which contains exactly one integer, indicating the number of train trips firstly canceled after the i-th attack.
Finally output one line, containing n integers, where the i-th integer is the time when the i-th train trip is firstly canceled or 0 if it is not affected.
Case #1: 0 2 1 0 2 3 2
题意:现在有n列火车,每列火车有自己的运营区间[L,R],现在有m个黑客,每个黑客攻击一个位置Xi,问每次攻击之后有几个火车停止运营,以及每列火车是在第几次攻击之后停止运营的,如果列车线路之间
包括攻击点Xi,那么该火车就停止运营。还有就是下一次攻击的节点是由上一次攻击结束之后得到的,也就是防止离线操作的。
思路:首先将该题简化,题意也就是说有n个区间[L,R],每次找到一个点,将包含该点的区间全部删除,找到每次操作之后有多少个区间收到影响,还需要记录一下每个区间在第几次操作之后被删除的。
牛客网暑期ACM多校训练营(第六场)I Team Rocket
原文:https://www.cnblogs.com/Flower-Z/p/9637590.html