Editorial for IOI '04 P4 - Phidias
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.
Use Dynamic Programming:
Let be the wasted area for a rectangle , , . Initially, put , for all except for the ones corresponding to needed plates, e.g. and , , for which we put . For a plate consider all vertical cuts and all horizontal cuts and chose the cut producing the minimum wasted area or for some .
Comments