結果

問題 No.430 文字列検索
ユーザー masatosismasatosis
提出日時 2022-05-12 13:19:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 61,724 KB
最終ジャッジ日時 2023-09-27 12:31:06
合計ジャッジ時間 6,887 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,948 KB
testcase_01 AC 868 ms
61,724 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 19 ms
9,088 KB
testcase_05 AC 19 ms
9,032 KB
testcase_06 AC 18 ms
9,040 KB
testcase_07 AC 19 ms
8,956 KB
testcase_08 AC 844 ms
61,428 KB
testcase_09 AC 19 ms
8,988 KB
testcase_10 AC 91 ms
14,748 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0