three way communication

please help me with my code…!! it’s giving wrong answer
https://www.codechef.com/viewsolution/12310880

Here’s one solution
#include<stdio.h>
int main()
{

int i,t,x[3],y[3],j,r,d1,d2,d3;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
    scanf("%d",&r);
    for(j=0;j<=2;j++)
    {
        scanf("%d",&x[j]);
        scanf("%d",&y[j]);

    }
    d1=(x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]);
    d2=(x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]);
    d3=(x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]);
    
    if((d1<=r*r)&&(d2<=r*r)&&(d3<=r*r))
    {
        printf("yes\n");
    continue;
    }
    if((d1>r*r)&&(d2>r*r)&&(d3>r*r))
    {
        printf("no\n");
    continue;
    }
    else if((d1>r*r&&d2<=r*r&&d3<=r*r)||(d2>r*r&&d3<=r*r&&d1<=r*r)||(d3>r*r&&d2<=r*r&&d1<=r*r))
    {
    printf("yes\n");
    
    }
    else
    printf("no\n");




}
return 0;

}

1 Like

thank you for helping !!

1 Like

so glad you upvoted me. Thanks a lot!