QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 512 MB Puntuación total: 100

#6353. 第 K 小的字典序最小子回文串

Estadísticas

考虑所有长度为 $n$ 且由 $1$ 到 $m$ 之间的整数组成的数组。令 $P$ 为此类数组中回文连续子数组数量的最小值。回想一下,如果一个数组等于其自身的反转,则称其为回文数组。

找出所有具有 $P$ 个回文连续子数组的数组中,字典序第 $k$ 小的数组。我们仍然只考虑长度为 $n$ 且由 $1$ 到 $m$ 之间的整数组成的数组。

换句话说,考虑所有长度为 $n$ 且由 $1$ 到 $m$ 之间的整数组成的数组,仅保留其中回文连续子数组数量最少的那些数组,并将它们按字典序排序。你的任务是找出其中第 $k$ 小的数组。

输入格式

输入仅一行,包含三个整数 $n, m$ 和 $k$ ($1 \le n \le 10^6, 1 \le m \le 10^6, 1 \le k \le 10^{18}$)。

输出格式

如果合法的数组少于 $k$ 个,输出 -1。否则,输出其中字典序第 $k$ 小的数组。

样例

样例输入 1

1 1 1

样例输出 1

1

样例输入 2

2 2 2

样例输出 2

2 1

样例输入 3

3 3 3

样例输出 3

2 1 3

样例输入 4

9 9 8244353

样例输出 4

2 4 1 2 6 8 1 2 7

样例输入 5

10 7 998244353

样例输出 5

-1

样例输入 6

3 1000 994253860

样例输出 6

998 244 353

说明

我们在标题里放了太多的“min”了吗?Min。

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.