結果

問題 No.1994 Confusing Name
ユーザー june19312
提出日時 2022-07-02 15:55:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 680 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,184 KB
実行使用メモリ 211,116 KB
最終ジャッジ日時 2024-11-27 10:25:47
合計ジャッジ時間 11,126 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

dict = {}
dict2 = {}

for i in range(N):
    tmp = list(input())

    for j in range(len(tmp)):

        if j == 0:
            tmp2 = "".join(tmp[1:]) + str(j)
        elif j == len(tmp)-1:
            tmp2 = "".join(tmp[:-1]) + str(j)
        else:
            tmp2 = "".join(tmp[:j]+tmp[j+1:]) + str(j)

        if tmp2 not in dict:
            dict[tmp2] = 1
            dict2[tmp2] = [i]
        else:
            dict[tmp2] += 1
            dict2[tmp2].append(i)

ans = [0]*N

for i,v in dict2.items():
    if len(v)>=2:
        for j in v:
            ans[j]+=(len(v)-1)

#    print(i,v)

#print(dict2)

for i,v in enumerate(ans):
    print(v)
0