問題一覧 > 通常問題

No.1933 ABC String

レベル : / AI推定難易度 : 2750 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 12
作問者 : ytqm3 / テスター : ぷら
お気に入りにしたユーザー ProblemId : 8001 / 自分の提出
問題文最終更新日: 2022-05-06 23:54:00
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 342 (順位表) の他の問題:

Problem Statement

You are given a string $S$ consisting of a, b, c and non-negative integers $A,B,C$.

Find the number, modulo $998244353$, of strings $T$ of length $A+B+C$ that contain exactly $A,B,C$ occurrences of a, b, c, respectively, and contain $S$ as a (not necessarily contiguous) subsequence.

Constraints

  • $1 \le |S| \le 2\times 10^5$
  • $0 \le A,B,C \le 2 \times 10^5$
  • $0 < A+B+C$
  • $S$ is a string consisting of a, b, c
  • Only inputs for which at least $1$ string $T$ satisfying the conditions exists are given

Input

$S$
$A$ $B$ $C$

Output

Output the answer.

Sample

Sample 1
Input
abc
2 1 1
Output
3

aabc, abac, abca satisfy the conditions.

Sample 2
Input
a
400 0 0
Output
1

Sample 3
Input
abcababcbabcbacbbab
314 159 265
Output
453546717

Do not forget to take the remainder modulo $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。