結果
| 問題 | No.430 文字列検索 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-05-12 13:19:22 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 448 bytes | 
| コンパイル時間 | 86 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 60,632 KB | 
| 最終ジャッジ日時 | 2024-11-10 01:00:35 | 
| 合計ジャッジ時間 | 6,708 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 5 WA * 9 | 
ソースコード
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, 10):
        if i + j > len(S):
            continue
        # print(i, j, S[i : i + j + 1])
        d[hash_dict[S[i : i + j]]] += 1
# print(d)
M = int(input())
ans = 0
for _ in range(M):
    C = input()
    ans += d[hash_dict[C]]
print(ans)
            
            
            
        