Hello, Here is my code........Can any one tell me why am i getting wrong answer?
even though it gives right answers for the sample test case and the one posted here.......? pls...........
#include<stdio.h>
int main()
{
int nt,i,n,m,j,x1,x2,y1,y2,xt,yt;
scanf("%d",&nt);
for(i=0;i<nt;i++)
{
scanf("%d %d",&n,&m);
int x[n],y[n];int out[m],k=0,l=0;
for(j=0;j<n;j++)
{
scanf("%d %d",&x[j],&y[j]);
}
for(j=0;j<m;j++)
{
scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
int lhs,rhs;
lhs=(xt-x1)*(y2-y1);
rhs=(yt-y1)*(x2-x1);
int cnt=0;
for(l=0;l<n;l++)
{
if(x[l]>=x1 && y[l]>=y1 && x[l]<=x2 && y[l]<=y2)
{
if(((x[l]-x1)*(y2-y1))==((y[l]-y1)*(x2-x1)))
cnt++;
}
}
out[j]=cnt;
}
for(j=0;j<m;j++)
{
printf("%d\n",out[j]);
}
}
getch();
}