QOJ.ac

QOJ

Limite de temps : 5 s Limite de mémoire : 512 MB Points totaux : 100

#1080. 虚幻地产

Statistiques

一个不诚实的土地所有者正在出售土地。他以大型矩形地块的形式出售土地,但许多地块相互重叠,因此他实际上是在多次出售同一块土地!这不是房地产,这是“虚假地产”!

给定该不诚实的土地所有者所出售的可能重叠的矩形地块的描述,计算这些地块所覆盖的土地总实际面积。

输入格式

输入包含多个测试用例。每个测试用例的第一行包含一个整数 $n$ ($0 < n \le 5,000$),表示出售的地块数量。接下来的 $n$ 行,每行包含四个实数,描述一个矩形地块:

$x1 \ y1 \ x2 \ y2$

其中 $(x1, y1)$ 是西南角坐标,$(x2, y2)$ 是东北角坐标 ($-1,000 \le x1 < x2 \le 1,000$, $-1,000 \le y1 < y2 \le 1,000$)。每个地块的面积至少为 $1$。

输入以一行包含单个 $0$ 的数据结束。

输出格式

对于每个测试用例,输出一个实数,表示所有矩形地块覆盖的土地总实际面积。输出结果需保留两位小数,并进行四舍五入。不要打印任何空格。输出之间不要打印任何空行。

样例

输入 1

2
0 0 100 100
30 30 60 60
2
0 100 300 200
100 0 200 300
0

输出 1

10000.00
50000.00

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.