题解 | #判断元素是否出现#
判断元素是否出现
http://www.nowcoder.com/practice/0787459e92bc4360ba48b094b7f21577
#include<bits/stdc++.h>
using namespace std;
int main(){
//write your code here......
int n, m, x;
unordered_map<int, int> mp;
cin>>n>>m;
for (int i = 0; i < n; i++) {
cin>>x;
mp[x]++;
}
while (m--) {
cin>>x;
if (mp.count(x)) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}