JDCC '16 Contest 5 P5 - Victory Towers
After your successful efforts in timing the alien invasion, Flatland has emerged victorious! \(N\) of the alien ships have been salvaged and the Flatlanders want to use them to build not one, not two, but three tall statues commemorating this independence day!
Each of the alien ships has it's own length. The Flatlanders line these ships up on end to form three stacks. In order to create a balanced visual piece, they would like to minimize the length of the longest statue. Can you help them determine the minimum height of the longest statue?
Each test case begins with an integer \(N\) \((1 \le N \le 50)\). The next line contains \(N\) integers \(H_i\) \((1 \le H_i \le 50)\), representing the lengths of the ships.
For each test case, output one integer : the minimum length of the longest statue.
4 1 2 3 2
6 3 4 5 4 9 8