ALGO ARTIS プログラミングコンテスト2023 秋 (AtCoder Regular Contest 168)
C
Swap Characters
AtCoder
⌀ 2071
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given a string $S$ of length $N$ consisting of the characters A, B, and C.

翻译中…

Consider performing the following operation between $0$ and $K$ times, inclusive:

翻译中…
  • Freely choose two characters in $S$ and swap them.
翻译中…

Find the number of strings that $S$ can be after the operations, modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 250000$
  • $1 \leq K \leq 100$
  • $S$ is a string of length $N$ consisting of the characters A, B, and C.
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K
S

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 1
ABC
Output #1
4
The following four strings can be obtained: - $S=$`ABC`: No operation is needed. - $S=$`BAC`: Swap the $1$-st and $2$-nd characters. - $S=$`CBA`: Swap the $1$-st and $3$-rd characters. - $S=$`ACB`: Swap the $2$-nd and $3$-rd characters.
Input #2
3 2
ABC
Output #2
6
Input #3
4 5
AAAA
Output #3
1
Input #4
30 10
CACCABAABBABABBCBBCAAACAAACCCA
Output #4
42981885
题目信息
题号
arc168_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。