Editorial for TLE '16 Contest 5 P4 - Engineering Test


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: d

First, add K to all of the t_i. This is the maximum allowed apparent weights of the tables. Next, generate the actual table patterns, which looks like a Pascal's triangle. A table adds half of its weight to the tables below. Make sure to round upwards when calculating the apparent weights.

To check if a certain table height H works, get the numbers in the top H rows, and sort these numbers. Afterwards, get the \dfrac{H(H+1)} 2 strongest tables. If there are enough tables, and these tables can support the structure, then this value of H will work.

Time Complexity: \mathcal{O}(N \log N \log K)


Comments

There are no comments at the moment.