Editorial for COCI '19 Contest 2 #3 Checker
Submitting an official solution before solving the problem yourself is a bannable offence.
Claim 1: In each triangulation with
Sketch of the proof: Induction. The claim holds for a square. Let a diagonal divide the polygon into two smaller polygons. If one of them is is a triangle, that is an ear. Otherwise, we make an inductive argument.
First, we will describe the process of triangulation checking. A naive algorithm will remove ear by ear. This can be more or less efficiently implemented and you could have solved the first two subtasks using an
Here we present one possible
For each diagonal
A linked list can be used to keep the current order of outer polygon nodes. Both color and triangulation checks can be done at the same time.
Comments