当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5603:the soldier of love

题目描述
Two days ago, the soldier of love ask a question to me.The problem can be described by linear programming.

For this question, I find that I can't solve it.after that, ZZQ told me that it can be transformed into an equivalent problem:

At first there are $N(1 \leq N \leq 3*10^{5})$segments, the i-th segment cover interval$[L_i, R_i]$($1 \leq L_i \leq R_i \leq 10^{6}$)

Then there are $M (1 \leq M \leq 3*10^{5})$ groups, the i-th group contains $K_i(1 \leq K_i \leq 3*10^{5}$) points's positions, which are respectively $P_1, P_2, ......, P_{k_i}$. For Convenience, we make $1 \leq P_1 < P_2 < ...... < P_{k_i} \leq 10^{6}$

we can also know the total number of points in all groups is no more than $3*10^5$
now the problem is that for each group, we want to know the total number of the segments, which include at least one given point in this group.
输入解释
Multiple cases of data (no more than 30 cases)

For each case, the first line contains two integers N and M, respectively, indicating the number of segments and M group.

The next N lines, each line contains two integers$L_i$ and $R_i$, represents the start and end positions of ith segment.


The next M lines, each line describes a group. Each line gives an integer K first, indicating the number of points in this group.Then K points' positions will be given in order.
输出解释
for each group,output the number of lines that contain at least one point in this group.
输入样例
3 3
1 3
4 5
6 7
3 1 4 7
2 4 5
1 8
输出样例
3
1
0
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5603

最后修改于 2020-10-25T23:24:07+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000/10000MS(Java/Others) 131072/131072K(Java/Others)