Editorial for COCI '08 Contest 2 #1 Kornislav


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.

The solution is to sort the numbers A, B, C and D and output the product of the first and third numbers.

We need to separate the four numbers into two sets, one containing horizontal moves {x1,x2}, the other containing vertical moves {y1,y2}. The area is then min(x1,x2)min(y1,y2). This expression is maximized when the two smallest numbers are in the same set.


Comments

There are no comments at the moment.