結果

問題 No.2201 p@$$w0rd
ユーザー toshiro_yanagi
提出日時 2025-04-11 17:18:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2025-04-11 17:19:02
合計ジャッジ時間 2,383 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, S = "N", "S"


def f2(x):
    return 2**x - 2


def f1(x):
    return 2**x - 1


def f_main(s):
    d = defaultdict(int)
    for c in s:
        if c in {"a", "s"}:
            d[S] += 1
        if c in {"l", "o"}:
            d[N] += 1

    if len(d) < 2:
        return 0
    elif sum(d.values()) == len(s):
        res = 0
        for a, b in [(S, N), (N, S)]:
            res += f2(d[a]) * f1(d[b])
        return res
    else:
        res = 1
        for v in d.values():
            res *= f1(v)
        return res


print(f_main(input()))
0