結果

問題 No.171 スワップ文字列(Med)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-27 20:38:00
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 297 ms / 1,000 ms
コード長 437 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 23,084 KB
最終ジャッジ日時 2023-10-24 18:38:29
合計ジャッジ時間 2,274 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,000 KB
testcase_01 AC 28 ms
10,000 KB
testcase_02 AC 119 ms
14,708 KB
testcase_03 AC 28 ms
10,064 KB
testcase_04 AC 28 ms
10,076 KB
testcase_05 AC 79 ms
12,648 KB
testcase_06 AC 179 ms
17,580 KB
testcase_07 AC 266 ms
21,896 KB
testcase_08 AC 292 ms
23,084 KB
testcase_09 AC 297 ms
23,084 KB
testcase_10 AC 27 ms
10,000 KB
testcase_11 AC 26 ms
10,000 KB
testcase_12 AC 27 ms
10,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

from collections import Counter

s = Counter(input())
li = list(s.values())
N = sum(li)

mod = 573
C = [ [0] * (N + 1) for i in range(N + 1) ]
for i in range(N + 1):
    C[i][0] = 1
    for j in range(1, i + 1):
        C[i][j] = C[i - 1][j] + C[i - 1][j - 1]
        if C[i][j] >= mod:
            C[i][j] -= mod

ans = 1
rem = N
for x in li:
    ans = ans * C[rem][x] % mod
    rem -= x
print((ans - 1) % mod)
0