QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 10

#226. Magic towers [A]

Statistiques

In Bitocja, there are $n$ mages, and each of them owns two towers. Each mage is able to teleport between their towers, so the other Bitocjans (ordinary citizens) do not know which of the two towers a given mage is currently in.

For more or less rational reasons, Bitocjans like to surround themselves with mages. We say that a Bitocjan feels safe if they are at a point such that in any direction they move from this point, they would get closer to one of the mages (regardless of which towers the mages are currently in). Bitocjans prefer to build their houses only at points where they feel safe; all these points form a safe area.

Find the area of the safe region (it may happen that no point is safe – in that case, the area is 0).

Input

The first line of the input contains a single integer $n$ ($3 \le n \le 100$) denoting the number of mages in Bitocja. The next $n$ lines describe the locations of the mages' towers; the $i$-th of these lines contains four integers $ax_i, ay_i, bx_i, by_i$ ($-500 \le ax_i, ay_i, bx_i, by_i \le 500$) indicating that the towers of the $i$-th mage are located at points $(ax_i, ay_i)$ and $(bx_i, by_i)$.

No two towers are located at the same point (i.e., the $2n$ points given in the input are pairwise distinct).

Output

Your program should output a single real number – the area of the safe region.

The allowed relative or absolute error is $10^{-8}$. This means that if the exact result is $A$, and you output $B$, your answer will be accepted only if $|A - B| \le \max(A, 1) \cdot 10^{-8}$.

Examples

Input 1

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

Output 1

4.8000000000

Note

The image below shows the positions of the mages' towers (black dots) and the safe area (gray figure). The point $(1, 1\frac{1}{2})$ is safe: for every direction, there exists a mage such that moving from the point $(1, 1\frac{1}{2})$ in that direction causes one to get closer to both towers of that mage. The point $(5, 5)$ is not safe: moving from it upwards will cause one to move away from all towers except the second tower of the fourth mage.

Subtasks

Each of the following points indicates that there is at least one test group that satisfies the conditions of this point (not counting groups that satisfy previous conditions).

  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.