QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 10

#226. 魔法塔 [A]

統計

在 Bitocja 生活着 $n$ 位法师,每位法师拥有两座塔。每位法师都能够在自己的两座塔之间传送,因此其他 Bitocja 人(普通公民)无法得知该法师当前身处哪一座塔。

出于各种或多或少的合理原因,Bitocja 人喜欢被法师环绕。我们称一个 Bitocja 人感到“安全”,如果他所处的点满足:无论从该点向任何方向移动,都会靠近某位法师(无论该法师当前身处哪一座塔)。Bitocja 人最愿意在他们感到安全的点上建造房屋;所有这些点构成了“安全区域”。

请计算安全区域的面积(可能不存在任何安全点,此时面积为 0)。

输入格式

第一行包含一个整数 $n$ ($3 \le n \le 100$),表示 Bitocja 的法师人数。接下来的 $n$ 行描述了法师塔的位置;第 $i$ 行包含四个整数 $ax_i, ay_i, bx_i, by_i$ ($-500 \le ax_i, ay_i, bx_i, by_i \le 500$),表示第 $i$ 位法师的两座塔分别位于 $(ax_i, ay_i)$ 和 $(bx_i, by_i)$。

没有任何两座塔位于同一个点(即输入给出的 $2n$ 个点两两不同)。

输出格式

你的程序应输出一个实数,即安全区域的面积。

允许的相对或绝对误差为 $10^{-8}$。这意味着如果精确结果为 $A$,而你输出的结果为 $B$,则只有在 $|A - B| \le \max(A, 1) \cdot 10^{-8}$ 时,你的答案才会被接受。

样例

样例输入 1

4
0 0 0 -1
-1 5 -2 2
4 0 4 1
2 2 6 6

样例输出 1

4.8000000000

说明 1

下图展示了法师塔的位置(黑点)以及安全区域(灰色图形)。点 $(1, 1\frac{1}{2})$ 是安全的:对于每一个方向,都存在一位法师,使得从点 $(1, 1\frac{1}{2})$ 向该方向移动会靠近该法师的两座塔。点 $(5, 5)$ 不安全:从该点向上移动会远离除第四位法师的第二座塔之外的所有塔。

子任务

以下每一项表示至少存在一组测试数据满足该条件(不包括满足先前条件的组):

  1. $n \le 10, -30 \le ax_i, ay_i, bx_i, by_i \le 30$
  2. $n \le 10$
  3. $-30 \le ax_i, ay_i, bx_i, by_i \le 30$

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.