Problem Statement:Valid Path

There is a rectangle with the left top as (0, 0) and the right bottom as (x, y). There are N circles such that their centers are inside the rectangle. The radius of each circle is R. Now we need to find out if it is possible that we can move from (0, 0) to (x, y) without touching any circle.

Notes:

* We can move from any cell to any of its 8 adjacent neighbors and we cannot move outside the boundary of the rectangle at any poll of time.
* A circle doesn't touch a cell (i,j) if the distance from its center to the cell (i,j) is less than R.




co-ordinates are choosen randomaly

Using Algorithm: