#P1659. [国家集训队] 拉拉队排练

    ID: 644 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>字符串WC/CTSC/集训队前缀和Manacher 算法

[国家集训队] 拉拉队排练

Description

The Ailiston Business School basketball team is going to compete in the annual city basketball tournament. The cheerleading squad is a highlight of the game; a good squad can often boost morale and help the team win. As the captain of the cheerleading squad, Chu Yuxin knows how important it is to train the squad well.

The selection is over. With the choices made by Yuxin and the principal, nn girls with excellent figures and dance skills have been chosen from many applicants. These girls will stand with the basketball team and cheer for Ailiston.

On a sunny morning, Yuxin led the team to start rehearsal. The nn girls line up from left to right. Each girl holds a sign bearing one of the 2626 lowercase letters, which they will wave during the game.

Yuxin notices that if a contiguous segment of girls has an odd number of members, and the letters on their signs read the same from left to right and from right to left, then this segment is called a harmonious group.

Now Yuxin wants to find all harmonious groups. After sorting them by the number of girls in descending order, what is the product of the sizes of the first KK harmonious groups? Since the answer can be large, please report the remainder when divided by 1993072619930726.

Input Format

The first line contains two positive integers nn and KK, as described above.

The second line contains nn characters, representing the letters on the signs from left to right.

Output Format

Output a single integer: the remainder of the product described in the statement divided by 1993072619930726. If the total number of harmonious groups is less than KK, output 1-1.

5 3
ababa
45

Hint

Sample Explanation

After sorting the letters of harmonious groups from left to right by group size in descending order, they are ababa, aba, aba, bab, a, a, a, b, b. The product of the first three lengths is 5×3×3=455 \times 3 \times 3 = 45.

Constraints

Test point 1n1 \le n \le 1K1 \le K \le
11 1010
232\sim3 100100
474\sim7 10001000
88 10510^5 11
9119\sim11 10510^5
121412\sim14 101210^{12}
151715\sim17 5×1055\times 10^5
1818 10610^6 11
1919 10610^6
2020 101210^{12}

Translated by ChatGPT 5