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

建议使用的浏览器:

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

6980:Restore Atlantis II

题目描述
There are $n$ ancient Greek maps describing the fabled islands Atlantis. The maps are labeled by $1,2,\dots,n$. The $i$-th map shows the rectangle area $R_i$ is a part of Atlantis. The sides of all rectangles are parallel to the axes. There may be multiple islands, and the rectangles may overlap.

Unfortunately, some maps are even unreliable so they will not be considered. You will be given $q$ queries. In the $i$-th query, you will be given two integers $s_i$ and $t_i$ ($1\leq s_i\leq t_i\leq n$). Please write a program to figure out the total area of Atlantis when only maps labeled by $k$ ($s_i\leq k\leq t_i$) are reliable.
输入解释
The first line contains a single integer $T$ ($1 \leq T \leq 3$), the number of test cases. For each test case:

The first line of the input contains two integers $n$ and $q$ ($1 \leq n,q \leq 100\,000$), denoting the number of maps and the number of queries.

In the next $n$ lines, the $i$-th line contains four integers $xa_i$, $ya_i$, $xb_i$ and $yb_i$ ($0\le xa_i<xb_i\leq 10^9$, $0\le ya_i<yb_i\leq 10^9$), describing the $i$-th map $R_i$. $(xa_i,ya_i)$ is the southwest corner of $R_i$, and $(xb_i,yb_i)$ is the northeast corner of $R_i$.

In the next $q$ lines, the $i$-th line contains two integers $s_i$ and $t_i$ ($1\leq s_i\leq t_i\leq n$), describing the $i$-th query.

It is guaranteed that all the values of $xa_i$, $ya_i$, $xb_i$, $yb_i$, $s_i$ and $t_i$ are chosen uniformly at random from integers in their corresponding ranges. The randomness condition does not apply to the sample test case, but your solution must pass the sample as well.
输出解释
For each query, print a single line containing an integer, denoting the total area using the information of all reliable maps in this query.
输入样例
1
3 6
10 10 20 20
12 12 22 22
15 15 25 25
1 1
2 2
3 3
1 2
2 3
1 3
输出样例
100
100
100
136
151
187

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

源链接: HDU-6980

最后修改于 2021-10-23T19:10:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
15000/15000MS(Java/Others) 524288/524288K(Java/Others)