E - I Wanna be The Prism Editorial
by
sungjae0506
Editorial for printing
The key idea of the solution is as follows.
Let the area of the base triangle be \(A\), its perimeter be \(P\), and the height of the triangular prism be \(h\). Then \(V = Ah\) and \(S = 2A + Ph\), so \(\frac{V}{S} = \frac{Ah}{2A+Ph}\).
For a fixed base triangle, this value increases as \(h\) increases. Hence, to include all given points, we should choose the minimum possible height, which is \(H = z_{\max} - z_{\min}\).
Now that the height is fixed, the problem reduces to finding a base triangle on the \(xy\)-plane that contains all projected points. For fixed \(H\), we have \(\frac{V}{S} = \frac{AH}{2A+PH} = \frac{H(A/P)}{2(A/P)+H}\).
Thus, minimizing \(\frac{V}{S}\) is equivalent to minimizing \(\frac{A}{P}\).
For a triangle with inradius \(r\), we have \(A = \frac{Pr}{2}\), and therefore \(\frac{A}{P} = \frac{r}{2}\).
Therefore, the problem is transformed into finding a triangle that contains the convex hull and has the minimum possible inradius.
Points inside the convex hull do not affect the answer, so it is sufficient to consider only the convex hull of the projected \(xy\)-points. The inradius of any triangle containing the convex hull cannot be smaller than the radius of the maximum inscribed circle of the convex hull.
Conversely, if we take the three edges of the convex hull that are tangent to its maximum inscribed circle and extend their supporting lines, they form a triangle containing the convex hull. This triangle has the minimum possible inradius, and therefore gives the optimal base triangle.
The algorithm is to first compute the convex hull of the projected \(xy\)-points, then find the maximum inscribed circle of the convex hull. After that, we find the three hull edges tangent to this circle, extend their supporting lines to form the optimal base triangle, and set the height of the prism to \(z_{\max}-z_{\min}\).
The convex hull can be computed in \(O(N\log N)\) time. Let \(M\) be the number of vertices of the convex hull, and let \(K\) be the coordinate range. The center of the maximum inscribed circle can be found in \(O(M \log M \log K)\) time using half-plane intersection and binary search.
Alternatively, it can be found in expected \(O(M)\) time using 3D randomized incremental linear programming.

posted:
last update:
