結果

問題 No.1994 Confusing Name
ユーザー tassei903tassei903
提出日時 2022-07-01 22:20:26
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 899 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 749,388 KB
最終ジャッジ日時 2024-05-04 16:42:38
合計ジャッジ時間 4,707 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
70,692 KB
testcase_01 AC 42 ms
63,000 KB
testcase_02 AC 41 ms
62,724 KB
testcase_03 AC 36 ms
55,412 KB
testcase_04 AC 36 ms
55,696 KB
testcase_05 AC 71 ms
87,988 KB
testcase_06 AC 105 ms
99,128 KB
testcase_07 AC 57 ms
75,528 KB
testcase_08 AC 93 ms
97,504 KB
testcase_09 AC 107 ms
102,544 KB
testcase_10 AC 85 ms
95,080 KB
testcase_11 AC 73 ms
87,552 KB
testcase_12 MLE -
testcase_13 -- -
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 #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n = ni()
s = [input() for i in range(n)]
from collections import defaultdict
m = 26
big = 10**20
d = defaultdict(int)
t = []
for i in range(n):
    f = big * len(s[i])
    g = 1
    for j in range(len(s[i])):
        f += (ord(s[i][j])-97)*g
        g *= 26
    t.append(f)
    d[f] += 1

for i in range(n):
    z = t[i]
    ans = 0
    g = 1
    for j in range(len(s[i])):
        x = ord(s[i][j])-97
        for k in range(26):
            if x!=k:
                y = z + g * (k - x)
                ans += d[y]
        g *= 26
    print(ans)
0