백준 195851 백준 19585번 : 전설 (Python) (트라이 없이) 출처 : https://www.acmicpc.net/problem/19585 import sys input = sys.stdin.readline c, n = map(int, input().split()) tree_c = dict() set_n = set() def insert(tree, word) : cur = tree for char in word : if char not in cur : cur[char] = dict() cur = cur[char] cur["*"] = len(word) def startswith(tree, word) : cur = tree for char in word : if char not in cur : return False cur = cur[char] if "*" in cur.. 2023. 3. 14. 이전 1 다음