結果

問題 No.1994 Confusing Name
ユーザー ikomaikoma
提出日時 2022-07-01 22:09:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 154,740 KB
最終ジャッジ日時 2023-08-17 09:41:35
合計ジャッジ時間 9,822 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,876 KB
testcase_01 AC 99 ms
71,460 KB
testcase_02 AC 93 ms
71,860 KB
testcase_03 AC 94 ms
71,588 KB
testcase_04 AC 93 ms
71,808 KB
testcase_05 AC 112 ms
77,740 KB
testcase_06 AC 125 ms
77,460 KB
testcase_07 AC 105 ms
77,460 KB
testcase_08 AC 122 ms
77,928 KB
testcase_09 AC 125 ms
77,704 KB
testcase_10 AC 115 ms
77,708 KB
testcase_11 AC 113 ms
77,840 KB
testcase_12 AC 371 ms
126,924 KB
testcase_13 AC 419 ms
145,396 KB
testcase_14 AC 429 ms
143,120 KB
testcase_15 AC 384 ms
150,272 KB
testcase_16 AC 349 ms
150,992 KB
testcase_17 AC 370 ms
154,740 KB
testcase_18 AC 473 ms
147,392 KB
testcase_19 AC 481 ms
147,416 KB
testcase_20 AC 476 ms
147,516 KB
testcase_21 AC 198 ms
97,840 KB
testcase_22 AC 161 ms
86,816 KB
testcase_23 AC 427 ms
137,160 KB
testcase_24 AC 415 ms
134,748 KB
testcase_25 AC 302 ms
126,540 KB
testcase_26 AC 209 ms
99,484 KB
testcase_27 AC 388 ms
136,580 KB
testcase_28 AC 319 ms
135,548 KB
testcase_29 AC 148 ms
86,140 KB
testcase_30 AC 331 ms
141,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
S=[input().strip() for _ in range(N)]
from collections import defaultdict
cnt=defaultdict(int)

for s in S:
    for i in range(len(s)):
        a = s[0:i]+"*"+s[i+1:]
        cnt[a]+=1

for s in S:
    ans=0
    for i in range(len(s)):
        a = s[0:i]+"*"+s[i+1:]
        ans += cnt[a]-1
    print(ans)
0