結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-12 13:22:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,105 ms / 2,000 ms |
| コード長 | 459 bytes |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 92,352 KB |
| 最終ジャッジ日時 | 2024-11-10 01:00:45 |
| 合計ジャッジ時間 | 7,846 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
# print(d, hash_dict)
M = int(input())
ans = 0
for _ in range(M):
C = input()
ans += d[hash_dict[C]]
print(ans)