結果

問題 No.430 文字列検索
ユーザー maspymaspy
提出日時 2020-02-27 01:48:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 45,676 KB
最終ジャッジ日時 2024-04-21 16:43:42
合計ジャッジ時間 3,627 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,624 KB
testcase_01 AC 228 ms
45,676 KB
testcase_02 AC 199 ms
11,136 KB
testcase_03 AC 203 ms
11,136 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,624 KB
testcase_06 AC 25 ms
10,624 KB
testcase_07 AC 25 ms
10,624 KB
testcase_08 AC 231 ms
45,400 KB
testcase_09 AC 26 ms
10,496 KB
testcase_10 AC 43 ms
13,312 KB
testcase_11 AC 201 ms
16,672 KB
testcase_12 AC 200 ms
16,544 KB
testcase_13 AC 196 ms
16,676 KB
testcase_14 AC 194 ms
14,316 KB
testcase_15 AC 199 ms
13,056 KB
testcase_16 AC 195 ms
11,136 KB
testcase_17 AC 202 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

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