結果

問題 No.1994 Confusing Name
ユーザー sotanishysotanishy
提出日時 2022-07-01 22:05:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 155,344 KB
最終ジャッジ日時 2023-08-17 09:38:35
合計ジャッジ時間 8,652 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,728 KB
testcase_01 AC 89 ms
71,772 KB
testcase_02 AC 86 ms
71,836 KB
testcase_03 AC 84 ms
71,576 KB
testcase_04 AC 85 ms
71,660 KB
testcase_05 AC 104 ms
78,080 KB
testcase_06 AC 118 ms
78,152 KB
testcase_07 AC 97 ms
77,560 KB
testcase_08 AC 113 ms
77,900 KB
testcase_09 AC 115 ms
78,076 KB
testcase_10 AC 106 ms
77,916 KB
testcase_11 AC 105 ms
77,872 KB
testcase_12 AC 304 ms
127,544 KB
testcase_13 AC 364 ms
145,760 KB
testcase_14 AC 377 ms
143,784 KB
testcase_15 AC 325 ms
150,412 KB
testcase_16 AC 292 ms
148,812 KB
testcase_17 AC 325 ms
155,344 KB
testcase_18 AC 401 ms
148,004 KB
testcase_19 AC 404 ms
147,844 KB
testcase_20 AC 407 ms
148,148 KB
testcase_21 AC 169 ms
97,544 KB
testcase_22 AC 141 ms
86,636 KB
testcase_23 AC 350 ms
137,536 KB
testcase_24 AC 339 ms
135,012 KB
testcase_25 AC 250 ms
124,492 KB
testcase_26 AC 181 ms
99,484 KB
testcase_27 AC 326 ms
137,100 KB
testcase_28 AC 268 ms
133,052 KB
testcase_29 AC 137 ms
85,752 KB
testcase_30 AC 277 ms
139,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.readline

N = int(input())
S = [input().rstrip() for _ in range(N)]
cnt = defaultdict(int)
for s in S:
    for i in range(len(s)):
        t = s[:i] + '?' + s[i+1:]
        cnt[t] += 1
for s in S:
    ans = 0
    for i in range(len(s)):
        t = s[:i] + '?' + s[i+1:]
        ans += cnt[t]
    ans -= len(s)
    print(ans)
0