#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
using namespace std;
map<string, set<int> > mp[6];
int main() {
string s;
char buf[1000];
int n;
scanf("%d", &n);
while (n--) {
int id;
scanf("%d", &id);
getchar();
gets(buf);
mp[1][string(buf)].insert(id);
gets(buf);
mp[2][string(buf)].insert(id);
gets(buf);
int len = strlen(buf);
int l = 0, r = 0;
for (; r < len; r++)
if (buf[r] == ' ') {
mp[3][string(buf+l, buf+r)].insert(id);
l = r + 1;
}
mp[3][string(buf+l, buf+len)].insert(id);
gets(buf);
mp[4][string(buf)].insert(id);
gets(buf);
mp[5][string(buf)].insert(id);
}
int m;
scanf("%d", &m);
while (m--) {
int se;
scanf("%d: ", &se);
gets(buf);
s = string(buf);
printf("%d: %s\n", se, buf);
if (!mp[se][s].size())
printf("Not Found\n");
else
for (set<int>::iterator it = mp[se][s].begin(); it != mp[se][s].end(); it++)
printf("%07d\n", *it);
}
return 0;
}
1022 Digital Library ---map+set
最新推荐文章于 2022-03-05 16:21:34 发布