题解 | #判断元素是否出现#
判断元素是否出现
https://www.nowcoder.com/practice/0787459e92bc4360ba48b094b7f21577
#include<bits/stdc++.h>
#include <cstddef>
#include <map>
using namespace std;
int main(){
//write your code here......
int n,num ;
cin >> n;
cin>>num;
map<int,int>maps;
for(int i = 0 ; i < n; i++ ){
int key;
cin >> key;
maps[key] = 1;
}
for(int i =0;i < num;i++){
int key;
cin >> key;
if(maps[key] != NULL){
cout << "yes"<<endl;
}else{
cout << "no"<<endl;
}
}
return 0;
}
