P3879 [TJOI2010] 阅读理解
#include <bits/stdc++.h>
using namespace std;
map<string,vector<int> >mp;
int main(){
int n,m;
cin >> n;
string str;
for(int i=1;i<=n;i++){
int L;
cin >> L;
for(int j=0;j<L;j++){
cin >> str;
if(mp[str][i]!=NULL){
while(0);
}
else{
mp[str].push_back(i);
}
}
}
cin >> m;
for(int i=0;i<m;i++){
cin >> str;
for(int j=1;j<mp[str].size();j++){
cout << mp[str][j] << " ";
}
cout << endl;
}
return 0;
}