結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
29,700 KB
testcase_01 AC 127 ms
29,716 KB
testcase_02 AC 135 ms
30,780 KB
testcase_03 AC 126 ms
29,720 KB
testcase_04 AC 127 ms
29,716 KB
testcase_05 WA -
testcase_06 AC 135 ms
31,588 KB
testcase_07 AC 144 ms
32,960 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 128 ms
29,732 KB
testcase_11 AC 126 ms
29,696 KB
testcase_12 AC 127 ms
29,716 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)
0