結果

問題 No.2388 At Least K-Characters
ユーザー ShirotsumeShirotsume
提出日時 2023-07-21 22:33:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 923 ms / 4,000 ms
コード長 928 bytes
コンパイル時間 1,119 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 243,212 KB
最終ジャッジ日時 2023-09-18 12:56:00
合計ジャッジ時間 23,886 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
80,492 KB
testcase_01 AC 162 ms
80,572 KB
testcase_02 AC 167 ms
81,744 KB
testcase_03 AC 163 ms
80,716 KB
testcase_04 AC 162 ms
80,736 KB
testcase_05 AC 161 ms
80,900 KB
testcase_06 AC 162 ms
80,672 KB
testcase_07 AC 165 ms
80,916 KB
testcase_08 AC 165 ms
80,992 KB
testcase_09 AC 166 ms
80,564 KB
testcase_10 AC 165 ms
80,884 KB
testcase_11 AC 166 ms
80,872 KB
testcase_12 AC 167 ms
80,576 KB
testcase_13 AC 186 ms
84,692 KB
testcase_14 AC 189 ms
84,392 KB
testcase_15 AC 185 ms
84,792 KB
testcase_16 AC 799 ms
242,496 KB
testcase_17 AC 704 ms
242,988 KB
testcase_18 AC 819 ms
242,528 KB
testcase_19 AC 818 ms
242,876 KB
testcase_20 AC 851 ms
242,964 KB
testcase_21 AC 890 ms
242,848 KB
testcase_22 AC 887 ms
242,732 KB
testcase_23 AC 923 ms
242,976 KB
testcase_24 AC 879 ms
242,744 KB
testcase_25 AC 833 ms
242,872 KB
testcase_26 AC 899 ms
243,212 KB
testcase_27 AC 869 ms
242,924 KB
testcase_28 AC 888 ms
242,868 KB
testcase_29 AC 867 ms
242,720 KB
testcase_30 AC 878 ms
242,796 KB
testcase_31 AC 837 ms
243,092 KB
testcase_32 AC 816 ms
242,864 KB
testcase_33 AC 820 ms
242,496 KB
testcase_34 AC 877 ms
242,740 KB
testcase_35 AC 893 ms
242,852 KB
testcase_36 AC 875 ms
242,672 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)]

dp[0][0] = 0
S = set()
ans = 0
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
        if len(S) >= k:
            ans += 1
        S.add(a[i])
    for j in range(k, 27):
        ans += dp[i][j]
        ans %= mod
print(ans)
0