/* Name: NYOJ--86--找球号(一) Date: 20/04/17 14:45 Description: 理想很美好,现实很残酷,准备用字符串水过,结果TLE了 ╮(╯▽╰)╭ */ #ifdef FAIL #include<iostream> using namespace std; int main(){ // freopen("in.txt","r",stdin); ios::sync_with_stdio(false); int m,n; cin>>m>>n; cin.get();//读换行 string str; getline(cin,str); str.insert(str.begin(),' '); str += " "; for(int i=0; i<n; ++i){ string s;cin>>s; s.insert(s.begin(),' '); s.append(" "); if(str.find(s) == string::npos)cout<<"NO"<<endl; else cout<<"YES"<<endl; } return 0; } #elif 1 #include<set> #include<iostream> using namespace std; int main(){ // freopen("in.txt","r",stdin); ios::sync_with_stdio(false); int m,n,a; cin>>m>>n; set<int> s; for(int i=0; i<m; ++i){ cin>>a; s.insert(a); } for(int i=0; i<n; ++i){ cin>>a; if(s.find(a) != s.end())cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; } #endif