hi… my code is correct to the point if i take Q=1 only…
for(i=0;i<q;i++)
{
scanf("%lld",&g);
for(i=0;i<g;i++)
scanf("%lld",&k[i]);
}
on doing this my code will replace the value of previous k[]…there would be many arrays req. this way.
please tell how to overcome this part.
#include<stdio.h>
int main()
{
long long sum,n,a,i,count=0,s[100000],k[100000],e[100000],q,g,j;
scanf("%lld",&n);
for(i=0;i<n;i++)
scanf("%lld %lld",&s[i],&e[i]);
scanf("%lld",&q);
/*for(i=0;i<q;i++)
{*/
scanf("%lld",&g);
for(i=0;i<g;i++)
scanf("%lld",&k[i]);
// }
for(i=0;i<g;i++){
for(j=0;j<n;j++){
if(k[i]<=e[j]&&k[i]>=s[j])
{
count++;
s[j]=0;e[j]=0;
}
printf("%lld \n",count);
printf("%lld %lld\n",s[j],e[j]);
}
}
printf("%lld\n",count);
return 0;
}