#P16604. [SYSUCPC 2025] SYSU III
[SYSUCPC 2025] SYSU III
题目描述
As you all know, you are participating in the SYSUCPC (SYSU Constructive Problem Contest) finals. Undoubtedly, the Constructive Kingdom of Sun Yat-sen University is eager for you to tackle some related problems.
Given a string containing only lowercase letters, determine the maximum number of disjoint subsequences of length that can be formed, such that all subsequences are . Formally, a subsequence of a string is a subset of characters of that read from left to right.
A greedy algorithm is currently used: each time, starting from the end, an unused is considered, and it is matched with nearest unused sequentially to form a qualified subsequence, which is then removed.
You are now requested to provide a string such that the answer obtained by the greedy method is , while the correct answer is . If no such exists, output .
输入格式
The only line contains two integers .
输出格式
A string such that the answer obtained by the greedy method is , while the correct answer is . If no such exists, output . The length of must not exceed .
1 1
ilovesysu
2 1
-1