結果

問題 No.2388 At Least K-Characters
ユーザー ShirotsumeShirotsume
提出日時 2023-07-21 22:30:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 916 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 242,872 KB
最終ジャッジ日時 2023-09-18 12:55:41
合計ジャッジ時間 23,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
80,848 KB
testcase_01 AC 172 ms
80,428 KB
testcase_02 AC 177 ms
81,576 KB
testcase_03 AC 169 ms
80,636 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 174 ms
80,524 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 175 ms
80,628 KB
testcase_12 WA -
testcase_13 AC 193 ms
84,792 KB
testcase_14 AC 197 ms
84,708 KB
testcase_15 AC 192 ms
84,480 KB
testcase_16 AC 841 ms
242,464 KB
testcase_17 AC 732 ms
242,612 KB
testcase_18 AC 839 ms
242,412 KB
testcase_19 AC 846 ms
242,844 KB
testcase_20 AC 873 ms
242,872 KB
testcase_21 AC 913 ms
242,848 KB
testcase_22 AC 920 ms
242,540 KB
testcase_23 AC 953 ms
242,664 KB
testcase_24 AC 887 ms
242,860 KB
testcase_25 AC 858 ms
242,864 KB
testcase_26 AC 903 ms
242,784 KB
testcase_27 AC 889 ms
242,864 KB
testcase_28 AC 910 ms
242,860 KB
testcase_29 AC 883 ms
242,872 KB
testcase_30 AC 903 ms
242,424 KB
testcase_31 AC 860 ms
242,580 KB
testcase_32 AC 857 ms
242,860 KB
testcase_33 AC 841 ms
242,648 KB
testcase_34 AC 902 ms
242,520 KB
testcase_35 AC 908 ms
242,696 KB
testcase_36 AC 905 ms
242,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import string
s = string.ascii_lowercase
n, m, k = mi()
a = input()
dp = [[0] * (30) for _ in range(m + 2)]

S = set()
ans = -1
for i in range(m + 1):
    for j in range(27):
        dp[i + 1][j] += dp[i][j] * j
        dp[i + 1][j] %= mod
        dp[i + 1][j + 1] += dp[i][j] * (26-j)
        dp[i + 1][j + 1] %= mod
    L = len(S)
    if i < n:
        p = s.index(a[i])
        for to in range(0, p):
            if s[to] not in S:
                dp[i + 1][L + 1] += 1
            else:
                dp[i + 1][L] += 1
        S.add(a[i])
        if len(S) >= k:
            ans += 1
    for j in range(k, 27):
        ans += dp[i][j]
        ans %= mod
print(ans)
0