Editorial for Mock CCC '18 Contest 2 J4/S2 - A Geometry Problem


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.

Author: xiaowuc1

We start by computing the sum of the areas of the rectangle and checking that it is a perfect square.

We now wish to verify whether we can build a square with side length s. One of the rectangles must have a side length of s and be on the end of the rectangle. If it has dimensions s \times a, then we just need to check if the other two rectangles can form a rectangle with dimensions s \times (s-a).

Two rectangles can form a rectangle of dimensions x \times y if the rectangles have dimensions either x \times z and x \times (y-z) or z \times y and (x-z) \times y.


Comments

There are no comments at the moment.