Editorial for COCI '06 Contest 3 #3 Trojke
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
We first find all letters in the input grid and make note of their positions. After that, for each triplet of letters, we check if there is a line going through all of them.
There is more than one way to check if there is such a line, one of which is to calculate the area of the triangle formed by the three points; if the area is zero, then the points lie on one line.
Comments