結果

問題 No.2201 p@$$w0rd
ユーザー rlangevinrlangevin
提出日時 2023-02-03 21:28:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 78,280 KB
最終ジャッジ日時 2023-09-15 16:53:29
合計ジャッジ時間 4,218 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
77,560 KB
testcase_01 AC 109 ms
77,812 KB
testcase_02 AC 107 ms
77,220 KB
testcase_03 AC 118 ms
77,612 KB
testcase_04 AC 115 ms
77,752 KB
testcase_05 AC 117 ms
77,984 KB
testcase_06 AC 106 ms
77,332 KB
testcase_07 AC 119 ms
78,080 KB
testcase_08 AC 104 ms
77,328 KB
testcase_09 AC 106 ms
77,000 KB
testcase_10 AC 117 ms
77,732 KB
testcase_11 AC 121 ms
77,960 KB
testcase_12 AC 112 ms
77,808 KB
testcase_13 AC 112 ms
77,532 KB
testcase_14 AC 119 ms
77,628 KB
testcase_15 AC 118 ms
77,676 KB
testcase_16 AC 111 ms
78,072 KB
testcase_17 AC 118 ms
78,060 KB
testcase_18 AC 123 ms
78,252 KB
testcase_19 AC 119 ms
77,908 KB
testcase_20 AC 115 ms
77,660 KB
testcase_21 AC 124 ms
78,280 KB
testcase_22 AC 120 ms
77,872 KB
testcase_23 AC 123 ms
77,864 KB
権限があれば一括ダウンロードができます

ソースコード

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