結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
64,584 KB
testcase_01 AC 37 ms
60,036 KB
testcase_02 AC 39 ms
60,344 KB
testcase_03 AC 32 ms
53,204 KB
testcase_04 AC 32 ms
52,532 KB
testcase_05 AC 63 ms
79,976 KB
testcase_06 AC 91 ms
94,024 KB
testcase_07 AC 49 ms
68,732 KB
testcase_08 AC 83 ms
91,824 KB
testcase_09 AC 95 ms
93,864 KB
testcase_10 AC 65 ms
81,208 KB
testcase_11 AC 63 ms
79,588 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:
                pass
            else:
                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