結果

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

ソースコード

diff #

from collections import defaultdict

N, S = "N", "S"


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


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


def f1(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):
        for a, b in [(S, N), (N, S)]:
            res = f2(d[a]) * f3(d[b])
        return res
    else:
        res = 1
        for v in d.values():
            res *= f2(v)
        return res


print(f1(input()))
0