結果

問題 No.1994 Confusing Name
ユーザー ntudantuda
提出日時 2022-10-25 22:45:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 157,292 KB
最終ジャッジ日時 2023-09-16 19:29:32
合計ジャッジ時間 10,562 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,932 KB
testcase_01 AC 86 ms
71,824 KB
testcase_02 AC 92 ms
71,732 KB
testcase_03 AC 86 ms
71,616 KB
testcase_04 AC 88 ms
71,620 KB
testcase_05 AC 112 ms
77,784 KB
testcase_06 AC 129 ms
77,780 KB
testcase_07 AC 103 ms
77,544 KB
testcase_08 AC 121 ms
77,976 KB
testcase_09 AC 124 ms
77,904 KB
testcase_10 AC 111 ms
77,976 KB
testcase_11 AC 112 ms
77,760 KB
testcase_12 AC 421 ms
133,672 KB
testcase_13 AC 399 ms
155,488 KB
testcase_14 AC 424 ms
156,564 KB
testcase_15 AC 361 ms
144,896 KB
testcase_16 AC 329 ms
125,780 KB
testcase_17 AC 356 ms
134,492 KB
testcase_18 AC 440 ms
157,292 KB
testcase_19 AC 439 ms
157,100 KB
testcase_20 AC 443 ms
157,256 KB
testcase_21 AC 191 ms
95,536 KB
testcase_22 AC 161 ms
85,932 KB
testcase_23 AC 394 ms
146,444 KB
testcase_24 AC 377 ms
147,300 KB
testcase_25 AC 292 ms
122,372 KB
testcase_26 AC 213 ms
104,260 KB
testcase_27 AC 368 ms
138,108 KB
testcase_28 AC 312 ms
118,092 KB
testcase_29 AC 149 ms
85,108 KB
testcase_30 AC 318 ms
122,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
dic = defaultdict(int)
for s in S:
    for i in range(len(s)):
        dic[s[:i] + "?" + s[i+1:]] += 1
ans = [0] * N
for j,s in enumerate(S):
    tmp = 0
    for i in range(len(s)):
        tmp +=  dic[s[:i] + "?" + s[i+1:]] - 1
    print(tmp)
0