You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict def main(): counts = input().split() n = int(counts[0]) m = int(counts[1]) group_a = defaultdict(list) for i in range(n): element = input() group_a[element].append(i+1) for _ in range(m): element = input() if group_a[element] == []: print(-1) else: print(" ".join(str(x) for x in group_a[element])) if __name__ == "__main__": main()
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 →