Why is my answer wrong? TCs are running fine. help pls ;(

Contest Page | 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;

}

It should be while(t--)

It is not necessary that there will be only two phrases. The total number of phrases should be equal to k.

1 Like

Timely reminder:

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

2 Likes

Okie, I’ll keep that in mind.

1 Like