結果

問題 No.171 スワップ文字列(Med)
ユーザー chocoruskchocorusk
提出日時 2020-09-14 10:42:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 33,608 KB
最終ジャッジ日時 2023-09-04 00:35:44
合計ジャッジ時間 2,862 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

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):
    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)
0