I submitted a result for the three way communications problem and I checked for the sample input given on ideone.com,it gives the correct result however it gives a wrong answer notice when I submitted it,I used cin and cout and even after changing that too scanf and printf it gives wrong answer please help.
Here is the code I used.
#include
int main()
{
int nCase,nMaxr,dummy;
long x1,x2,x3,y1,y2,y3,dist1,dist2,dist3,k,ans[101]={0};
scanf("%d",&nCase);
dummy=nCase;
while(nCase>0)
{
scanf("%d",&nMaxr);
k=nMaxr*nMaxr;
scanf("%ld",&x1);
scanf("%ld",&y1);
scanf("%ld",&x2);
scanf("%ld",&y2);
scanf("%ld",&x3);
scanf("%ld",&y3);
dist1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
dist2=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
dist3=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);
if(((dist1<=k)&&(dist2<=k))||((dist2<=k)&&(dist3<=k))||((dist1<=k)&&(dist3<=k)))
{
ans[nCase]=1;
}
nCase--;
}
for(int i=dummy;i>0;i--)
{
if(ans[i]==1)
{
printf("Yes \n");
}
else
{
printf("No \n");
}
}
}