結果

問題 No.430 文字列検索
ユーザー 💕💖💞💕💖💞
提出日時 2017-01-28 18:43:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 9,200 KB
最終ジャッジ日時 2023-08-25 13:22:32
合計ジャッジ時間 3,999 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,832 KB
testcase_01 AC 269 ms
9,144 KB
testcase_02 AC 257 ms
9,200 KB
testcase_03 AC 257 ms
9,160 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 16 ms
7,764 KB
testcase_06 AC 16 ms
7,888 KB
testcase_07 AC 16 ms
7,824 KB
testcase_08 AC 127 ms
8,120 KB
testcase_09 AC 17 ms
7,832 KB
testcase_10 AC 25 ms
7,836 KB
testcase_11 AC 254 ms
9,188 KB
testcase_12 AC 255 ms
8,984 KB
testcase_13 AC 254 ms
9,036 KB
testcase_14 AC 266 ms
9,060 KB
testcase_15 AC 260 ms
9,036 KB
testcase_16 AC 249 ms
9,156 KB
testcase_17 AC 258 ms
9,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
m = int(input())
search = set()
[search.add(input()) for _ in range(m)]
maxlen = max(map(lambda x:len(x), search))
result = 0
for start in range(len(s)):
    for width in range(1, min(len(s) - start, maxlen) + 1):
        result += 1 if s[start:start+width] in search else 0
print(result)
0