結果

問題 No.430 文字列検索
ユーザー maspy
提出日時 2020-02-27 01:48:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,828 KB
最終ジャッジ日時 2024-11-10 00:41:09
合計ジャッジ時間 3,080 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter

# %%
S = readline().rstrip().decode()
M = int(readline())
query = read().decode().split()


# %%
counter = [None] * 11
for L in range(11):
    counter[L] = Counter(S[i: i + L] for i in range(0, len(S) - L + 1))

# %%
answer = sum(counter[len(C)][C] for C in query)
print(answer)
0