CF999A Mishka and Contest

题目描述

给出长度为 $n$ 的数列,每次只能删除右端或左端小于等于 $k$ 的数,求最多能删除几个数。

输入格式

- 第一行 $n, k$; - 第二行输入 $n$ 个数,表示要删除的数列。

输出格式

- 一个数,表示最多能删除几个数。

说明/提示

In the first example, Mishka can solve problems in the following order: $ [4, 2, 3, 1, 5, 1, 6, 4] \rightarrow [2, 3, 1, 5, 1, 6, 4] \rightarrow [2, 3, 1, 5, 1, 6] \rightarrow [3, 1, 5, 1, 6] \rightarrow [1, 5, 1, 6] \rightarrow [5, 1, 6] $ , so the number of solved problems will be equal to $ 5 $ . In the second example, Mishka can't solve any problem because the difficulties of problems from both ends are greater than $ k $ . In the third example, Mishka's solving skill is so amazing that he can solve all the problems.