#P9828. [ICPC 2020 Shanghai R] Octasection
[ICPC 2020 Shanghai R] Octasection
题目描述
At the Namomo Camp, a cute volunteer celebrates her birthday. Wowo buys her a huge cake. (The cake is so big that it has a 3D coordinate system inside.) There are cuboid shaped pieces of chocolates the cake. The -th () chocolate consists of all points such that $min\_x[i]\le x\le max\_x[i], min\_y[i]\le y\le max\_y[i], min\_z[i]\le z\le max\_z[i]$. are arrays of integers. Chocolates may overlap or touch each other.
The volunteer wants to distribute the cake to the campers of the Namomo Camp. To show off his knife skill, Wowo decides to cut the cake into pieces by exactly cuts such that:
- The first cut is a plane whose equation is for some integer decided by Wowo.
- The second cut is a plane whose equation is for some integer decided by Wowo.
- The third cut is a plane whose equation is for some integer decided by Wowo.
- Each chocolate is by at least one cut (i.e. each cuboid has a nonempty intersection with at least one plane).
Decide whether Wowo can cut the cake under the rules. If the answer is yes, output any possible solution.
输入格式
The first line contains a single integer ().
The -th line of the next lines contains integers $min\_x[i],max\_x[i], min\_y[i],max\_y[i], min\_z[i], max\_z[i]$ ($-10^9\le min\_x[i],max\_x[i], min\_y[i],max\_y[i], min\_z[i], max\_z[i]\le 10^9$, , , ).
输出格式
If Wowo can cut the cake under the rules, the first line of the output should contain YES and the second line should contain integers , and (). If Wowo cannot cut the cake under the rules, output only one line containing NO.
3
0 1 0 1 0 1
10 11 10 11 10 11
999999999 1000000000 999999999 1000000000 999999999 1000000000
YES
0 10 999999999
4
0 1 0 1 0 1
999999999 1000000000 0 1 0 1
0 1 999999999 1000000000 0 1
0 1 0 1 999999999 1000000000
YES
0 0 0