結果

問題 No.1994 Confusing Name
コンテスト
ユーザー sotanishy
提出日時 2022-07-01 22:05:47
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 391 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 407 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 163,840 KB
最終ジャッジ日時 2026-05-20 16:35:02
合計ジャッジ時間 6,405 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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