結果
| 問題 |
No.2388 At Least K-Characters
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2025-02-06 19:57:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 566 ms / 4,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 622 ms |
| コンパイル使用メモリ | 82,572 KB |
| 実行使用メモリ | 81,032 KB |
| 最終ジャッジ日時 | 2025-02-06 19:57:37 |
| 合計ジャッジ時間 | 15,027 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
n,m,k=map(int,input().split())
K=26
s=input()
s=[ord(c)-ord("a") for c in s]
q=[0]*(K+1)
a=0
M=998244353
c=[0]*K
for i in range(m):
nq=[0]*(K+1)
for j in range(1,K+1):
nq[j]+=q[j]*j
if j<K:
nq[j+1]+=q[j]*(K-j)
g=sum(c)
if i<n:
for j in range(s[i]):
if c[j]:
nq[g]+=1
else:
nq[g+1]+=1
c[s[i]]=1
q=nq
for j in range(1,K+1):
q[j]%=M
a+=i<n-1 and sum(c)>=k
a+=sum(q[k:])
a%=M
print(a)
sasa8uyauya