結果
問題 |
No.1994 Confusing Name
|
ユーザー |
|
提出日時 | 2022-07-01 21:28:55 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 545 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 876,216 KB |
最終ジャッジ日時 | 2024-11-26 03:52:24 |
合計ジャッジ時間 | 48,105 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 TLE * 14 MLE * 6 |
ソースコード
n = int(input()) cnt = {} def f(S): lst = [ord(s) - 96 for s in S] tot = 0 for l in lst: tot *= 26 tot += l times = 1 for l in lst[::-1]: tot -= times * l for j in range(1, 27): if j == l: continue tot += times * j cnt[tot] = cnt.get(tot, 0) + 1 tot -= times * j tot += times * l times *= 26 return tot lst = [] for _ in range(n): S = input() lst.append(f(S)) for s in lst: print(cnt.get(s, 0))