結果
| 問題 | No.1994 Confusing Name | 
| コンテスト | |
| ユーザー |  sasa8uyauya | 
| 提出日時 | 2024-08-25 20:25:05 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 524 bytes | 
| コンパイル時間 | 301 ms | 
| コンパイル使用メモリ | 82,444 KB | 
| 実行使用メモリ | 98,888 KB | 
| 最終ジャッジ日時 | 2024-08-25 20:25:11 | 
| 合計ジャッジ時間 | 6,116 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 1 TLE * 1 -- * 17 | 
ソースコード
n=int(input())
ss=[]
d={}
B=1007
M=1000000007
for i in range(n):
  s=input()
  h=0
  for j in range(len(s)):
    h+=ord(s[j])*(B**j)
    h%=M
  if h not in d:
    d[h]=0
  d[h]+=1
  ss+=[s]
for i in range(n):
  s=ss[i]
  h=0
  for j in range(len(s)):
    h+=ord(s[j])*(B**j)
    h%=M
  c=0
  for j in range(len(s)):
    h-=ord(s[j])*(B**j)
    for k in range(26):
      h+=(k+ord("a"))*(B**j)
      h%=M
      if h in d:
        c+=d[h]*(chr(k+ord("a"))!=s[j])
      h-=(k+ord("a"))*(B**j)
    h+=ord(s[j])*(B**j)
  print(c)
            
            
            
        