結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-22 06:35:20 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 439 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 18,560 KB |
| 最終ジャッジ日時 | 2024-11-10 00:20:01 |
| 合計ジャッジ時間 | 5,026 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
from collections import defaultdict
from sys import stdin
input = lambda: stdin.readline().rstrip()
def main():
S = input()
M = int(input())
C = stdin.read().splitlines()
strings = defaultdict(list)
for i, s in enumerate(S):
strings[s].append(i)
ans = 0
for ci in C:
l = len(ci)
for i in strings[ci[0]]:
if S[i:i+l] == ci:
ans += 1
print(ans)
main()