You have an n*m matrix with start position at (0, 0) and end position at (n, m).
There are c circles with centers inside the matrix, each with radius r. You are given the center co-ordinates (x, y) of each of those circles.
Note: You can move from any point to any of its 8 adjecent neighbours.
Find if there is a way to travel from start to end without touching any of these circles.
n: 5
m: 4
r: 1
circles(x, y): [(0, 2), (2, 3), (3, 0), (4, 1)]
Answer: True
Explanation: The valid path is shown in the diagram above.
The first line contains an integer âTâ denoting the number of test cases.
For each test case, the input has the following lines:
For each test case, the output contains a line with one integer 1 or 0, depending of whether there is a valid path or not respectively.
4
5 4 4 1
0 2
2 3
3 0
4 1
5 4 4 1
0 2
2 3
3 0
4 2
1 1 0 2
1 1 1 1
0 1
1
0
1
0
1 <= T <= 10
1 <= n, m <= 300
1 <= c <= 100
1 <= r <= 20
0 <= x <= n
0 <= y <= m