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

建议使用的浏览器:

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

3832:Posters

题目描述
Ted has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside. All things that Ted can find are rectangle posters.

However, Ted is such a picky guy that in every poster he finds something ugly. So before he pastes a poster on the window, he cuts a rectangular hole on that poster to remove the ugly part. Ted is also a careless guy so that some of the pasted posters may overlap when he pastes them on the window.

Ted wants to know the total area of the window covered by posters. Now it is your job to figure it out.

To make your job easier, we assume that the window is a rectangle located in a rectangular coordinate system. The window's bottom-left corner is at position (0, 0) and top-right corner is at position (50000, 50000). The edges of the window, the edges of the posters and the edges of the holes on the posters are all parallel with the coordinate axes.
输入解释
The input contains several test cases. For each test case, the first line contains a single integer N (0 < N <= 50000), representing the total number of posters. Each of the following N lines contains 8 integers x1, y1, x2, y2, x3, y3, x4, y4, showing details about one poster. (x1, y1) is the coordinates of the poster's bottom-left corner, and (x2, y2) is the coordinates of the poster's top-right corner. (x3, y3) is the coordinates of the hole's bottom-left corner, while (x4, y4) is the coordinates of the hole's top-right corner. It is guaranteed that 0 <= xi, yi <= 50000 (i = 1...4) and x1 <= x3 < x4 <= x2, y1 <= y3 < y4 <= y2.

The input ends with a line of single zero.
输出解释
For each test case, output a single line with the total area of window covered by posters.
输入样例
2
0 0 10 10 1 1 9 9
2 2 8 8 3 3 7 7
0
输出样例
56

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Ningbo 2009

源链接: POJ-3832

最后修改于 2020-10-29T07:13:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536