You are viewing a single comment's thread. Return to all comments →
Wityut DefaultDict
split_list = input().split() integer_list = list(map(int, split_list)) list_a = [] for i in range(integer_list[0]): list_a.append(input()) list_b = [] for i in range(integer_list[1]): list_b.append(input()) answer_1 = [] for element in list_b: sub_answer_1 = [] for i in range(len(list_a)): if list_a[i] == element: sub_answer_1.append(i+1) if sub_answer_1: answer_1.append(sub_answer_1) else: answer_1.append([-1]) for i in answer_1: print(*i)
Seems like cookies are disabled on this browser, please enable them to open this website
DefaultDict Tutorial
You are viewing a single comment's thread. Return to all comments →
Wityut DefaultDict