結果

問題 No.430 文字列検索
ユーザー satama6satama6
提出日時 2022-05-09 15:40:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 161,540 KB
最終ジャッジ日時 2023-09-23 14:15:11
合計ジャッジ時間 3,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,456 KB
testcase_01 AC 309 ms
151,912 KB
testcase_02 AC 147 ms
77,640 KB
testcase_03 AC 150 ms
77,652 KB
testcase_04 AC 72 ms
71,304 KB
testcase_05 AC 73 ms
71,440 KB
testcase_06 AC 72 ms
71,524 KB
testcase_07 AC 70 ms
71,208 KB
testcase_08 AC 280 ms
161,540 KB
testcase_09 AC 74 ms
71,376 KB
testcase_10 AC 92 ms
83,632 KB
testcase_11 AC 210 ms
92,060 KB
testcase_12 AC 208 ms
91,876 KB
testcase_13 AC 214 ms
91,612 KB
testcase_14 AC 191 ms
84,936 KB
testcase_15 AC 174 ms
81,944 KB
testcase_16 AC 151 ms
77,760 KB
testcase_17 AC 151 ms
77,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
M = int(input())
C = []
for _ in range(M):
    C.append(input())

cnt = dict()

N = len(S)
for i in range(N):
    s = ''
    for l in range(1, 11):
        j = i - l + 1
        if j < 0:
            break
        s = S[j] + s
        if s in cnt:
            cnt[s] += 1
        else:
            cnt[s] = 1

ans = 0
for i in range(M):
    if C[i] in cnt:
        ans += cnt[C[i]]

print(ans)
0