結果
問題 | No.430 文字列検索 |
ユーザー | yudai1102jp |
提出日時 | 2022-05-11 01:39:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 324 ms / 2,000 ms |
コード長 | 1,025 bytes |
コンパイル時間 | 1,385 ms |
コンパイル使用メモリ | 86,904 KB |
実行使用メモリ | 149,880 KB |
最終ジャッジ日時 | 2023-09-25 10:22:09 |
合計ジャッジ時間 | 4,595 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 89 ms
71,168 KB |
testcase_01 | AC | 324 ms
149,880 KB |
testcase_02 | AC | 166 ms
77,832 KB |
testcase_03 | AC | 166 ms
77,488 KB |
testcase_04 | AC | 88 ms
71,732 KB |
testcase_05 | AC | 90 ms
71,576 KB |
testcase_06 | AC | 88 ms
71,776 KB |
testcase_07 | AC | 90 ms
71,460 KB |
testcase_08 | AC | 288 ms
149,712 KB |
testcase_09 | AC | 94 ms
71,624 KB |
testcase_10 | AC | 113 ms
84,708 KB |
testcase_11 | AC | 201 ms
89,756 KB |
testcase_12 | AC | 200 ms
89,752 KB |
testcase_13 | AC | 204 ms
89,904 KB |
testcase_14 | AC | 194 ms
84,112 KB |
testcase_15 | AC | 182 ms
80,928 KB |
testcase_16 | AC | 165 ms
77,700 KB |
testcase_17 | AC | 163 ms
77,432 KB |
ソースコード
import math import sys import heapq from collections import deque sys.setrecursionlimit(500*500) stdin = sys.stdin def YES(): print('Yes') def NO(): print('No') def TAKAHASHI(): print('Takahashi') def AOKI(): print("Aoki") def ns(): return stdin.readline().strip() def ni(): return int(ns()) def na(): return list(map(int, stdin.readline().split())) def nz(): return list(map(lambda x: int(x)-1, stdin.readline().split())) def nm(n): return [na() for _ in range(n)] MOD = int(1e9+7) def YES(): print('Yes') def NO(): print('No') def TAKAHASHI(): print('Takahashi') def AOKI(): print("Aoki") s = ns() M = ni() s_set = [set()]*11 ans = 0 ord_a = ord('A') def o(s): return ord(s)-ord_a table = {} for i in range(10): for j in range(len(s)-i): if s[j:j+i+1] in table: table[s[j:j+i+1]] += 1 else: table[s[j:j+i+1]] = 1 for i in range(M): c = ns() lc = len(c) hc = 0 hs = 0 if c in table: ans += table[c] print(ans)