I am getting runtime error in my code for (Problem code:FRGTNLNG)( https://www.codechef.com/problems/FRGTNLNG/) Here’s my code (http://ideone.com/2L4YxO) Please help me I am a beginner.Thanks in advance.
You should adjust the limit of your array. Your code got AC when i increased your char array size. Here is the AC code-
#include <stdio.h>
#include<string.h>
int main(void) {
// your code goes here
int a,o,p,g,b,l,e,q,h;
scanf("%d",&a);
char t[25600][25600];
char v[25600][25600];
for(int i=1;i<=a;i++)
{
scanf("%d%d",&o,&p);
for(int r=0;r<o;r++)
{
scanf("%s",t[r]);
}
g=0;
for(int w=0;w<p;w++)
{
scanf("%d",&b);
for(e=g;e<b+g;e++)
{
scanf("%s",v[e]);
// printf("%s ",v[e]);
}
g=e;
}
for(q=0;q<o;q++)
{l=0;
for(h=0;h<b+g;h++)
{
if(strcmp(t[q],v[h])==0)
{
l=1;
break;
}
// printf("%s ",t[q]);
}
if(l==1)
printf("YES ");
else
printf("NO ");
}
printf("\n");
}
return 0;
}
Thank you very much Abhishek