結果

問題 No.171 スワップ文字列(Med)
ユーザー chocoruskchocorusk
提出日時 2020-09-14 10:45:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 469 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 33,404 KB
最終ジャッジ日時 2023-09-04 00:35:50
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
29,784 KB
testcase_01 AC 125 ms
29,744 KB
testcase_02 AC 135 ms
30,812 KB
testcase_03 AC 129 ms
29,652 KB
testcase_04 AC 127 ms
29,696 KB
testcase_05 AC 132 ms
30,272 KB
testcase_06 AC 138 ms
31,748 KB
testcase_07 AC 142 ms
33,028 KB
testcase_08 AC 145 ms
33,388 KB
testcase_09 AC 145 ms
33,404 KB
testcase_10 AC 123 ms
29,796 KB
testcase_11 AC 123 ms
29,652 KB
testcase_12 AC 125 ms
29,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

s=readline().rstrip().decode()
n=len(s)
import numpy as np
MOD=573
comb=np.zeros((n+1, n+1), np.int32)
comb[0][0]=1
for i in range(1, n+1):
    comb[i][:i]+=comb[i-1][:i]
    comb[i][1:i+1]+=comb[i-1][:i]
    comb[i]%=MOD
from collections import Counter
c=Counter(s)
ans=1
x=n
for y in c.values():
    ans*=comb[x][y]
    ans%=MOD
    x-=y
print((ans-1)%MOD)
0