I: Polygon Game

https://open.kattis.com/problems/polygongame

  • The main observation is that the final number of pieces in the polygon cannot be too big!

  • Even though each of the mm lines (cuts) has the potential to cut each polygon into two pieces (which might suggest that you can form 2m2^mpieces), the total number of pieces is actually at most m(m+1)2+1\frac{m \cdot (m+1)}{2}+1.

Try proving this upper bound! To gain some intuition, for m=2m=2 you can divide the plane into 44 regions. However, you cannot get 88 regions using 33 lines. The maximum number of regions you can create with 33 lines is 77.

  • Now, we can just simulate the polygon cutting process, which can be implemented trivially once we have primitives such as computing line intersections.

    • Maintain a list of existing polygons.

    • At each iteration, intersect the line with every polygon in the existing list.

    • Replace the list of polygons with the new (potentially) smaller polygons created in this iteration.

  • Finally, iterate through all the polygons that remain in the end, and report the maximum area.

Last updated