You are viewing a single comment's thread. Return to all comments →
The statement of this problem is so confusing... spent most of my time figure out where does the m and n come from..
from collections import defaultdict n, m = map(int, input().split()) d = defaultdict(list) for i in range(n): word = input() d[word].append(i + 1) for j in range(m): word = input() if len(d[word]) > 0: print(' '.join([str(s) for s in d[word]])) else: print(-1)
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 →
The statement of this problem is so confusing... spent most of my time figure out where does the m and n come from..