304325: CF825C. Multi-judge Solving

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Multi-judge Solving

题意翻译

DecoForces 上存在 $n$ 个问题,难度为 $a_1,a_2,a_3\cdots a_n$,你已经做到了难度最高为 $k$ 的题目。 现在存在两种 OJ,一个是上述的 DecoForces,一个是其他的 OJ。如果 DecoForces 没有某一难度的题目,那其他 OJ 上一定有。 假设你现在做到了难度为 $k$ 的题目,那你下次可以做 $a_i\le 2\times k$ 的题目,做完之后 $k$ 就要更新为你做过最难的题目。 你至少要在其他 OJ 上做几道题? Translate By [Aw顿顿](https://www.luogu.com.cn/user/212283)

题目描述

Makes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty — a positive integer number. Difficulties are measured the same across all the judges (the problem with difficulty $ d $ on Decoforces is as hard as the problem with difficulty $ d $ on any other judge). Makes has chosen $ n $ problems to solve on Decoforces with difficulties $ a_{1},a_{2},...,a_{n} $ . He can solve these problems in arbitrary order. Though he can solve problem $ i $ with difficulty $ a_{i} $ only if he had already solved some problem with difficulty ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF825C/dcc3f539eeb6ae660df27e0ba4735db648eac084.png) (no matter on what online judge was it). Before starting this chosen list of problems, Makes has already solved problems with maximum difficulty $ k $ . With given conditions it's easy to see that Makes sometimes can't solve all the chosen problems, no matter what order he chooses. So he wants to solve some problems on other judges to finish solving problems from his list. For every positive integer $ y $ there exist some problem with difficulty $ y $ on at least one judge besides Decoforces. Makes can solve problems on any judge at any time, it isn't necessary to do problems from the chosen list one right after another. Makes doesn't have too much free time, so he asked you to calculate the minimum number of problems he should solve on other judges in order to solve all the chosen problems from Decoforces.

输入输出格式

输入格式


The first line contains two integer numbers $ n $ , $ k $ ( $ 1<=n<=10^{3} $ , $ 1<=k<=10^{9} $ ). The second line contains $ n $ space-separated integer numbers $ a_{1},a_{2},...,a_{n} $ ( $ 1<=a_{i}<=10^{9} $ ).

输出格式


Print minimum number of problems Makes should solve on other judges in order to solve all chosen problems on Decoforces.

输入输出样例

输入样例 #1

3 3
2 1 9

输出样例 #1

1

输入样例 #2

4 20
10 3 6 3

输出样例 #2

0

说明

In the first example Makes at first solves problems 1 and 2. Then in order to solve the problem with difficulty 9, he should solve problem with difficulty no less than 5. The only available are difficulties 5 and 6 on some other judge. Solving any of these will give Makes opportunity to solve problem 3. In the second example he can solve every problem right from the start.

Input

题意翻译

DecoForces 上存在 $n$ 个问题,难度为 $a_1,a_2,a_3\cdots a_n$,你已经做到了难度最高为 $k$ 的题目。 现在存在两种 OJ,一个是上述的 DecoForces,一个是其他的 OJ。如果 DecoForces 没有某一难度的题目,那其他 OJ 上一定有。 假设你现在做到了难度为 $k$ 的题目,那你下次可以做 $a_i\le 2\times k$ 的题目,做完之后 $k$ 就要更新为你做过最难的题目。 你至少要在其他 OJ 上做几道题? Translate By [Aw顿顿](https://www.luogu.com.cn/user/212283)

加入题单

上一题 下一题 算法标签: