0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 05:38:47 +00:00
OI-codes/Luogu/P3879/P3879.cpp

31 lines
644 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
string s;
2020-12-30 12:01:30 +00:00
unordered_map<string, set<int> > m;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> l;
for (int j = 0; j < l; j++) {
cin >> s;
2020-12-30 10:59:08 +00:00
m[s].insert(i);
}
}
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
if (!m.count(s)) {
cout << endl;
2021-11-19 09:01:13 +00:00
} else {
2020-12-30 10:59:08 +00:00
for (set<int>::iterator it = m[s].begin(); it != --m[s].end(); it++) {
cout << *it << ' ';
}
cout << *--m[s].end() << endl;
}
}
return 0;
}