410298: GYM104003 F William and Cards
Description
William likes to play card games. In this particular game, William is dealt a row of $$$N$$$ playing cards. Each of the cards has a positive integer point value, where the $$$i$$$-th card in the row has a point value of $$$p_i$$$.
The object of the card game is to minimize the maximum point value among all of the cards that William has. To do so, William is allowed to perform operations. For any $$$1 \leq i < N$$$, William may halve $$$p_i$$$ and double $$$p_{i-1}$$$ so long as $$$p_i$$$ is an even number. William may perform as many operations as he desires.
If William performs operations optimally, can you figure out the minimum maximum point value that he can achieve?
InputThe input will begin with a line containing a single integer $$$N\ (1 \leq N \leq 10^5)$$$. The next line will contain $$$N$$$ space-separated integers $$$p_0, \dots, p_{N-1}\ (1 \leq p_i \leq 10^9)$$$, the initial point values of the $$$N$$$ playing cards that William is dealt.
OutputThe output should consist of a single integer representing the minimum maximum point value among all of the cards William is dealt assuming that he performs optimal operations.
ExampleInput5 1 25 36 80 12Output
25