結果

問題 No.2201 p@$$w0rd
ユーザー rlangevin
提出日時 2023-02-03 21:28:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 69,760 KB
最終ジャッジ日時 2024-07-02 19:11:47
合計ジャッジ時間 2,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def f(s):
    if s == "l":
        return 1
    elif s == "o":
        return 0
    elif s == "a":
        return "@"
    elif s == "s":
        return "$"
    else:
        return s

def check(L):
    if "@" not in L and "$" not in L:
        return False
    D = defaultdict(int)
    for a in L:
        D[a] += 1
    val = 0
    for i in range(10):
        val += D[i]
    if val == 0:
        return False
    alp = "abcdefghijklmnopqrstuvwxyz"
    val = 0
    for i in alp:
        val += D[i]
    if val == 0:
        return False
    return True

S = list(input())
N = len(S)
SS = set()
for s in range(1 << N):
    temp = [None] * N
    for i in range(N):
        if (s >> i) & 1:
            temp[i] = S[i]
        else:
            temp[i] = f(S[i])
    if check(temp):
        SS.add(tuple(temp))
print(len(SS))
0