結果
問題 |
No.430 文字列検索
|
ユーザー |
|
提出日時 | 2022-05-12 15:14:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 600 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 52,636 KB |
最終ジャッジ日時 | 2024-11-10 01:00:40 |
合計ジャッジ時間 | 6,367 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
from collections import Counter, defaultdict from random import randint S = input() # hash_dict = defaultdict(lambda: randint(1, (1 << 64) - 1)) d = Counter() for i in range(len(S)): for j in range(1, 11): if i + j > len(S): continue # print(i, j, S[i : i + j + 1]) # d[hash_dict[S[i : i + j]]] += 1 d[S[i : i + j]] += 1 # print(d, hash_dict) M = int(input()) ans = 0 for _ in range(M): C = input() # ans += d[hash_dict[C]] ans += d[C] print(ans)