Code not getting submitted


#1

class Pair{
int x;
int y;
Pair(int x,int y)
{
this.x=x;
this.y=y;
}
}
public class Solution {
int[] x1={0,1,1,1,0,-1,-1,-1};
int[] y1={1,1,0,-1,-1,-1,0,1};
int x,y,n,r;
int[] xc;
int[] yc;
boolean isthere(int p,int q)
{
if(p>=0&&q>=0&&p<=x&&q<=y)
return true;
return false;
}
boolean incircle(int p,int q)
{
int i,j,k;
for(i=0;i<n;i++)
{
int X=xc[i];
int Y=yc[i];
int d=(X-p)(X-p)+(Y-q)(Y-q);
if(dd<=rr)
return true;

    }
    return false;
}
public String solve(int A, int B, int C, int D, int[] E, int[] F) {
   x=A;
   y=B;
   n=C;
   r=D;
   xc=E;
   yc=F;
   if(incircle(0,0)||incircle(x,y))
   {
       return "NO";
   }
   int[][] visited=new int[x+1][y+1];
   LinkedList<Pair> ll=new LinkedList<Pair>();
   ll.add(new Pair(0,0));
   visited[0][0]=-1;
   int flag=0;
   int i,j,k;
   while(!ll.isEmpty())
   {
       Pair h=ll.remove(0);
       if(h.x==x&&h.y==y)
       {
           flag=1;
           break;
       }
       for(i=0;i<8;i++)
       {
           j=h.x+x1[i];
           k=h.y+y1[i];
           if(isthere(j,k)&&visited[j][k]!=-1&&(!incircle(j,k)))
           {
               ll.add(new Pair(j,k));
               visited[j][k]=-1;
           }
       }
   }
   if(flag==1)
   {
       return "YES";
   }
   else
   return "NO";
}

}

My code is giving wrong answer for:
A : 7
B : 91
C : 8
D : 7
E : [ 7, 1, 7, 1, 5, 1, 6 ]
F : [ 4, 74, 14, 90, 58, 37, 4 ]
Can someone tell me my mistake?