Editorial for Baltic OI '03 P1 - Barrel
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.
Given some water level
Another solution, which is much more educating, is to observe that the set of possible water levels can be split into a disjoint set of intervals such that within every interval each object is either floating or touches the lid. This allows solving the task using a linear equation. This is the so-called "scanning line" principle. Unfortunately, we do not see any way to force the contestants to use this method.
Comments