QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 512 MB 總分: 100

#11606. Bobby Tables

统计

小 Bobby Tables 在他的数据库中存储了他最喜欢的大数字。这些数字占用了大量内存,因此他正在设法更有效地存储它们。他注意到数据库中有一个数字 $X$,它没有大的质因数,他怀疑它是某种形式的 $\binom{n}{k}$,其中 $n, k$ 是相对较小的数字。

请帮助 Bobby 检查这是否属实。给定一个整数 $m$ 和 $X$ 的质因数分解,确定是否存在整数 $n, k$ 满足 $0 \le k \le n \le m$ 且 $X = \binom{n}{k}$。

输入格式

输入的第一行包含测试用例的数量 $z$ ($1 \le z \le 10\,000$)。接下来是各测试用例的描述。

每个测试用例的第一行包含两个整数 $t, m$ ($1 \le t, m \le 150\,000$),分别表示 $X$ 的质因数个数和输出值的上限。第二行包含 $t$ 个质数 $p_i$ ($2 \le p_i \le m$),使得所有 $p_i$ 的乘积为 $X$。

所有测试用例中 $t$ 的总和不超过 $200\,000$。所有测试用例中 $m$ 的总和不超过 $2\,000\,000$。

输出格式

对于每个测试用例,如果存在合适的 $n$ 和 $k$,则在第一行输出 “YES”,并在第二行输出 $n$ 和 $k$ 的值。否则,仅输出一行 “NO”。

样例

样例输入 1

2
2 5
3 2
3 7
2 2 2

样例输出 1

YES
4 2
NO

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.