题解 | #判断元素是否出现#
判断元素是否出现
https://www.nowcoder.com/practice/0787459e92bc4360ba48b094b7f21577
#include<bits/stdc++.h>
using namespace std;
int main(){
//write your code here......
int n,m;
cin>>n>>m;
int i=1,a;
set<int> s;
while(i<=n&&cin>>a)
{
s.insert(a);
i++;
}
while(m!=0)
{
int x;
cin>>x;
set<int>::iterator it1;
it1=s.find(x);
if(it1!=s.end())
{
cout<<"yes"<<endl;
}
else {
cout<<"no"<<endl;
}
m--;
}
return 0;
}

