QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 الصعوبة: [عرض] قابلة للهجوم ✓
الإحصائيات

Little Cyan Fish 热爱 LIS(最长上升子序列)的概念,他希望你构造出许多许多不同的 LIS!

在故事开始之前,回顾一下子序列的定义:子序列是通过从原序列中删除任意数量(可能为零)的元素而得到的序列。例如,4 3 5 是 2 4 1 3 5 的一个子序列。LIS(最长上升子序列)是指给定序列中最长的单调递增子序列。我们用 $\text{LIS}(a)$ 表示序列 $a$ 的 LIS 长度。例如,$\text{LIS}(2\ 4\ 1\ 3\ 5) = 3$。

对于两个整数序列 $p_1, p_2, \dots, p_k$ 和 $q_1, q_2, \dots, q_l$,序列 $p+q$ 是通过将序列 $p$ 和 $q$ 连接而得到的另一个序列 $r$。更正式地说,序列 $r$ 的长度为 $k+l$,其元素定义为:

$$r_i = \begin{cases} p_i & i \le k \\ q_{i-k} & \text{otherwise} \end{cases}, \text{对于所有 } 1 \le i \le k+l$$

现在,Little Cyan Fish 有一个包含 $n$ 个整数的序列 $a_1, a_2, \dots, a_n$,满足对于所有 $1 \le i \le n$,都有 $1 \le a_i \le m$。现在,他希望你找到另一个长度为 $m-n$ 的序列 $b$,使得:

  • $1 \le b_i \le m$。
  • $a$ 和 $b$ 中的所有整数互不相同。换句话说,$a+b$ 是一个长度为 $m$ 的排列。
  • $\text{LIS}(a+b) = \text{LIS}(b+a)$。

输入格式

输入包含多组测试数据。第一行包含一个整数 $T$ ($T \ge 1$),表示测试数据的组数。对于每组测试数据:

第一行包含两个整数 $n$ 和 $m$ ($1 \le n < m \le 10^6$)。 下一行包含 $n$ 个不同的整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le m$)。

保证所有测试数据的 $m$ 之和不超过 $10^6$。

输出格式

对于每组测试数据:

如果无法得到任何可行的方案,输出一行 “No”。 否则,第一行输出 “Yes”。 下一行输出 $m-n$ 个整数,表示构造出的序列 $b_1, b_2, \dots, b_{m-n}$。

样例

输入 1

3
3 6
2 6 5
7 12
3 7 6 9 10 2 1
3 6
1 2 3

输出 1

Yes
3 1 4
Yes
4 5 8 12 11
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.