P5229 [AHOI2013] Cube
Description
In a three-dimensional space, there are $N$ cubes. The $i$-th cube occupies the region from $(x_{i_1}, y_{i_1}, z_{i_1})$ to $(x_{i_2}, y_{i_2}, z_{i_2})$. These $N$ cubes may intersect or overlap. Together, they form a large geometric shape. Now, find the outer surface area of this shape.
Input Format
The first line contains an integer $N$, representing the number of cubes.
Lines $2$ to $N+1$ each contain $6$ integers separated by spaces, representing $x_1$, $y_1$, $z_1$, $x_2$, $y_2$, $z_2$.
Output Format
Output one line containing an integer, representing the outer surface area.
Explanation/Hint
All testdata satisfy $\in~[0,200]$.
$x_1~\leq~x_2$.
$y_1~\leq~y_2$.
$z_1~\leq~z_2$.
Translated by ChatGPT 5