FRGTNLNG Problem - CodeChef - Problem

My approach:

int main()

{

int t;

cin>>t;

while(t–)

{

int n,k;

cin>>n>>k;

string s[n];

```
for(int i=0;i<n;i++)
cin>>s[i];
int x;
int y;
cin>>x;
string s1[1000007];
for(int i=0;i<x;i++)
cin>>s1[i];
cin>>y;
for(int i=x;i<x+y;i++)
cin>>s1[i];
for(int i=0;i<n;i++)
{
int count=0;
for(int j=0;j<x+y;j++)
{
if(s[i].compare(s1[j])==0)
{
count=1;
cout<<"YES ";
break;
}
}
if(count!=1)
cout<<"NO ";
}
cout<<endl;
```

}

return 0;

}