Contest Remake

TimeLimit:8000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
The annual Chengdu Children Poker Contest (CCPC) has begun! Unfortunately, the cards have been all blown away during the contest and the contest cannot go ahead. You, as the contest organizer, need to prepare a rematch and reproduce a pack of cards for the rematch.

The cards used in the contest are quite special ― each card represents a set of integers. For a pack of $m$ cards, we denote the set represented by each card as $S_1,S_2,\dots,S_m$. The pack of the cards should meet the following conditions:

- The elements in each set are unordered and distinct.
- For every $i$, $S_i \subset \mathbb{Z}^+$ (the set of all positive integers), and $S_i \neq \emptyset$.
- For every $1 \le i \lt j \le m$, $S_i \neq S_j$.
- For every $i$, $\prod_{x \in S_i}x \le C$, where $C$ is a given constant.

What's more, a mystery guy tells you the reason why the cards are blown away is that you use some ominous integers. There are $n$ ominous integers, and you should avoid using them in case your cards get blown away again. We denote the set of ominous integers as $T$. That is:

- For every $i$, $S_i \cap T=\emptyset$.

You want to reproduce as many cards as possible. Now given $C$ and the $n$ ominous integers, please calculate the maximum number of cards in the pack.
Input
The first line contains a positive integer $T$ $(1\le T \le 20)$, indicating the number of test cases.

For each test case, the first line contains two integers $n, C$ $(0\le n\le 10^{5},1\le C \le 10^{9})$, indicating the number of ominous integers and the given constant.

The second line contains $n$ positive integers $a_1,a_2,\dots,a_n$ $(1\le a_i \le C)$, indicating the ominous integers. It is guaranteed that all the $n$ integers are distinct.

It is guaranteed that $\sum n\le 7\times 10^5$, and there are at most $10$ test cases that meet $C>10^6$.
Output
For each test case, print one integer in a single line, indicating the maximum number of cards in the pack.
SampleInput
2
1 6
3
2 10
3 5
SampleOutput
9
17
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: