結果

問題 No.1994 Confusing Name
ユーザー FromBooskaFromBooska
提出日時 2024-03-21 18:15:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 141,800 KB
最終ジャッジ日時 2024-03-21 18:15:11
合計ジャッジ時間 9,412 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,612 KB
testcase_01 AC 39 ms
55,612 KB
testcase_02 AC 40 ms
55,612 KB
testcase_03 AC 40 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 69 ms
70,904 KB
testcase_06 AC 93 ms
77,092 KB
testcase_07 AC 53 ms
64,420 KB
testcase_08 AC 85 ms
76,948 KB
testcase_09 AC 87 ms
77,080 KB
testcase_10 AC 68 ms
73,028 KB
testcase_11 AC 67 ms
70,904 KB
testcase_12 AC 372 ms
121,476 KB
testcase_13 AC 390 ms
138,980 KB
testcase_14 AC 409 ms
139,840 KB
testcase_15 AC 340 ms
141,660 KB
testcase_16 AC 323 ms
125,676 KB
testcase_17 AC 324 ms
127,744 KB
testcase_18 AC 426 ms
141,580 KB
testcase_19 AC 446 ms
141,620 KB
testcase_20 AC 421 ms
141,800 KB
testcase_21 AC 143 ms
94,244 KB
testcase_22 AC 109 ms
82,100 KB
testcase_23 AC 404 ms
132,444 KB
testcase_24 AC 366 ms
128,240 KB
testcase_25 AC 265 ms
113,428 KB
testcase_26 AC 170 ms
102,304 KB
testcase_27 AC 343 ms
128,068 KB
testcase_28 AC 281 ms
113,500 KB
testcase_29 AC 107 ms
81,428 KB
testcase_30 AC 280 ms
116,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 二重ループはできない、各Siの一字替えを辞書化

from collections import defaultdict

N = int(input())
S = []
dic = defaultdict(int)
for i in range(N):
    s = input()
    S.append(s)
    for j in range(len(s)):
        temp = s[:j]+'*'+s[j+1:]
        dic[temp] += 1
#print(S)
#print(dic)

for s in S:
    count = 0
    for j in range(len(s)):
        temp = s[:j]+'*'+s[j+1:]
        count += dic[temp]
    ans = count-len(s)
    print(ans)
0