#P9081. [PA 2018] Magiczne wieże

[PA 2018] Magiczne wieże

Problem Description

Translated from PA 2018 Round 3 Magiczne wieże.

In a kingdom, there are nn wizards. Each wizard has two magic towers. A wizard can teleport freely between their two towers.

For some reason, the residents of the kingdom only want to live in areas surrounded by wizards. Specifically, if a resident moves from their home in any direction, they will get closer to at least one wizard (at either of that wizard's towers), then their home is considered safe.

If we connect all safe homes in order, they form a safe region. Please find the area of this region.

Input Format

The first line contains an integer nn, which represents the number of wizards.

The next nn lines each contain 44 integers axi,ayi,bxi,byiax_i, ay_i, bx_i, by_i, describing the two magic towers a,ba, b owned by the ii-th wizard.

It is guaranteed that no two towers are at the same position.

Output Format

Output the area of the safe region. In particular, if there are no safe points, the area of the region is 00.

Your output must have relative error at most 10810^{-8} compared with the standard answer.

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

Hint

Explanation for Sample 1

As shown in the figure, the black line segments are the two towers of a wizard, and the gray area is the safe region.


Constraints

This problem uses bundled testdata.

For 100%100\% of the testdata, 3n1003 \leq n \leq 100, 500axi,ayi,bxi,byi500-500 \leq ax_i, ay_i, bx_i, by_i \leq 500.

There are 1010 subtasks. Among them, for each of the following conditions, there is at least one subtask that satisfies it (each line is one condition):

  • n10n \leq 10, 30axi,ayi,bxi,byi30-30 \leq ax_i, ay_i, bx_i, by_i \leq 30.
  • n10n \leq 10.
  • 30axi,ayi,bxi,byi30-30 \leq ax_i, ay_i, bx_i, by_i \leq 30.

Translated by ChatGPT 5