luogu#P5229. [AHOI2013] 立方体

[AHOI2013] 立方体

Problem Description

In a three-dimensional space, there are NN cubes. The ii-th cube occupies the region from (xi1,yi1,zi1)(x_{i_1}, y_{i_1}, z_{i_1}) to (xi2,yi2,zi2)(x_{i_2}, y_{i_2}, z_{i_2}). These NN 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 NN, representing the number of cubes.

Lines 22 to N+1N+1 each contain 66 integers separated by spaces, representing x1x_1, y1y_1, z1z_1, x2x_2, y2y_2, z2z_2.

Output Format

Output one line containing an integer, representing the outer surface area.

1
0 0 0 1 1 1
6
2 
0 1 0 3 2 1
1 0 0 2 3 1
22

Hint

All testdata satisfy  [0,200]\in~[0,200].

x1  x2x_1~\leq~x_2.

y1  y2y_1~\leq~y_2.

z1  z2z_1~\leq~z_2.

Translated by ChatGPT 5