目录
1.Digital Library
#include<cstdio>
#include<vector>
#include<cstring>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<math.h>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
map<string,set<int>> title,author,keyword,publish,pubyear;
void query(map<string,set<int>> &mp,string &str){
if(mp.find(str)==mp.end()) printf("Not Found\n");
else{
for(set<int>::iterator it=mp[str].begin();it!=mp[str].end();it++){
printf("%07d\n",*it);
}
}
}
int main(){
int n;
scanf("%d",&n);
int id;
string t,a,k,p,y;
for(int i=0;i<n;i++){
scanf("%d",&id);
getchar();
getline(cin,t);
title[t].insert(id);
getline(cin,a);
author[a].insert(id);
char temp;
while(cin>>k){
keyword[k].insert(id);
temp=getchar();
if(temp=='\n') break;
}
getline(cin,p);
publish[p].insert(id);
getline(cin,y);
pubyear[y].insert(id);
}
int m;
scanf("%d",&m);
int type;
string temp;
for(int i=0;i<m;i++){
scanf("%d: ",&type);
getline(cin,temp);
cout<<type<<": "<<temp<<endl;
if(type==1) query(title,temp);
else if(type==2) query(author,temp);
else if(type==3) query(keyword,temp);
else if(type==4) query(publish,temp);
else query(pubyear,temp);
}
return 0;
}