結果

問題 No.430 文字列検索
ユーザー burita083burita083
提出日時 2021-07-17 10:11:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 396 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 52,792 KB
最終ジャッジ日時 2023-09-21 03:06:53
合計ジャッジ時間 4,349 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,492 KB
testcase_01 AC 396 ms
52,792 KB
testcase_02 AC 226 ms
8,968 KB
testcase_03 AC 225 ms
9,028 KB
testcase_04 AC 19 ms
8,576 KB
testcase_05 AC 19 ms
8,424 KB
testcase_06 AC 19 ms
8,588 KB
testcase_07 AC 19 ms
8,476 KB
testcase_08 AC 396 ms
52,784 KB
testcase_09 AC 19 ms
8,484 KB
testcase_10 AC 46 ms
11,652 KB
testcase_11 AC 249 ms
14,376 KB
testcase_12 AC 255 ms
14,208 KB
testcase_13 AC 247 ms
14,196 KB
testcase_14 AC 237 ms
12,044 KB
testcase_15 AC 236 ms
11,436 KB
testcase_16 AC 230 ms
9,248 KB
testcase_17 AC 227 ms
9,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

S = input()
d = defaultdict(int)
for i in range(1, 11):
    for j in range(len(S) - i + 1):
        d[S[j:j + i]] += 1

ans = 0
M = int(input())
for _ in range(M):
    ans += d[input()]
print(ans)

0