結果

問題 No.1994 Confusing Name
ユーザー 👑 rin204rin204
提出日時 2022-07-01 21:28:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 545 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 407,856 KB
最終ジャッジ日時 2024-05-04 15:35:14
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
64,544 KB
testcase_01 AC 43 ms
59,136 KB
testcase_02 AC 42 ms
59,648 KB
testcase_03 AC 34 ms
51,712 KB
testcase_04 AC 39 ms
51,968 KB
testcase_05 AC 76 ms
79,232 KB
testcase_06 AC 97 ms
93,824 KB
testcase_07 AC 51 ms
68,608 KB
testcase_08 AC 90 ms
91,976 KB
testcase_09 AC 109 ms
93,696 KB
testcase_10 AC 68 ms
80,384 KB
testcase_11 AC 75 ms
79,104 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt = {}
def f(S):
    lst = [ord(s) - 96 for s in S]
    tot = 0
    for l in lst:
        tot *= 26
        tot += l
    times = 1
    for l in lst[::-1]:
        tot -= times * l
        for j in range(1, 27):
            if j == l:
                continue
            tot += times * j
            cnt[tot] =  cnt.get(tot, 0) + 1
            tot -= times * j
        tot += times * l
        times *= 26
    return tot

lst = []
for _ in range(n):
    S = input()
    lst.append(f(S))

for s in lst:
    print(cnt.get(s, 0))
0