Editorial for Another Contest 9 Problem 1 - Black Room Boy
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.
The bounds are sufficiently low for this problem that many different approaches work.
For people who know about sets, one can loop over all pairs of integers and assign those to be in the horizontal direction, and the other two integers summed are assigned to the vertical direction. These pairs of sums can be thrown into a set and then printed in order.
For people who don't know sets, one can brute force all rectangular rooms that have perimeter equal to and check which are valid.
Comments