解法:
map
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
#define endl '\n'
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n;cin >> n;
int a;
string s;
map<int, string> mp;
map<string, int> mpis;
while (n--) {
cin >> a >> s;
mp[a] = s;
mpis[s] = 1;
}
int k; cin >> k;
while (k--) {
cin >> s >> a;
if (mpis[s]) {
if (mp.find(a) == mp.end()) {
mp[a] = "ti";
}
}
}
int m; cin >> m;
while (m--) {
cin >> a;
if (mp.find(a) != mp.end()) {
cout << "no" << endl;
}
else cout << "yes" << endl;
}
return 0;
}