結果

問題 No.1994 Confusing Name
ユーザー kept1994kept1994
提出日時 2022-10-30 18:56:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 502 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 144,852 KB
最終ジャッジ日時 2023-09-21 17:20:48
合計ジャッジ時間 11,494 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,444 KB
testcase_01 AC 96 ms
71,444 KB
testcase_02 AC 95 ms
71,956 KB
testcase_03 AC 93 ms
71,448 KB
testcase_04 AC 96 ms
71,648 KB
testcase_05 AC 122 ms
78,012 KB
testcase_06 AC 141 ms
78,312 KB
testcase_07 AC 109 ms
77,448 KB
testcase_08 AC 134 ms
78,032 KB
testcase_09 AC 135 ms
78,252 KB
testcase_10 AC 122 ms
78,272 KB
testcase_11 AC 122 ms
78,168 KB
testcase_12 AC 397 ms
122,120 KB
testcase_13 AC 454 ms
138,344 KB
testcase_14 AC 474 ms
144,852 KB
testcase_15 AC 415 ms
136,452 KB
testcase_16 AC 382 ms
124,596 KB
testcase_17 AC 387 ms
129,912 KB
testcase_18 AC 486 ms
138,584 KB
testcase_19 AC 502 ms
138,924 KB
testcase_20 AC 496 ms
139,140 KB
testcase_21 AC 193 ms
89,304 KB
testcase_22 AC 166 ms
86,436 KB
testcase_23 AC 448 ms
132,080 KB
testcase_24 AC 431 ms
135,000 KB
testcase_25 AC 338 ms
116,372 KB
testcase_26 AC 235 ms
99,152 KB
testcase_27 AC 426 ms
127,716 KB
testcase_28 AC 343 ms
116,856 KB
testcase_29 AC 166 ms
85,244 KB
testcase_30 AC 350 ms
116,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from collections import defaultdict
INF = 10 ** 16

def main():
    N = int(input())
    d = defaultdict(int)
    names = []
    for i in range(N):
        name = input()
        names.append(name)
        for i in range(len(name)):
            g = name[:i] + "*" + name[(i + 1):]
            d[g] += 1
    for name in names:
        ans = -len(name)
        for i in range(len(name)):
            g = name[:i] + "*" + name[(i + 1):]
            ans += d[g]
        print(ans)
    return


if __name__ == '__main__':
    main()
0