CF1119B Alyona and a Narrow Fridge
题目描述
一个大小是 $2\times h$ 的冰箱(就是 $2$ 列 $h$ 行),有 $n$ 个瓶子,高度分别是 $a_1,a_2,\cdots,a_n$,要求把最多瓶子放进冰箱(要求按顺序)。
瓶子只能放在架子上。可以有任意多个架子。架子不能把瓶子砍成两瓣。
输入格式
第一行:$n(1\leq n\leq 10^3)$,$h(1\leq h\leq 10^9)$。
第二行:$a_1,a_2,\cdots,a_n(1\leq a_i\leq h)$。
输出格式
一行,一个数 $k$,表示能把 $a_1,a_2,\cdots,a_k$ 放进冰箱。
### 样例解释
样例 1:
样例 2:
样例 3:
说明/提示
One of optimal locations in the first example is shown on the picture in the statement.
One of optimal locations in the second example is shown on the picture below.
One of optimal locations in the third example is shown on the picture below.
