width, height). There are round ponds in and around it: ponds[i] = [x, y, r] is a pond centred at (x, y) with radius r. A pond may stick out of the park partly or completely.
You need to walk from the corner (0, 0) to the corner (width, height) along any curve that:
- lies entirely inside the park and touches its border only at those two corners;
- never enters any pond and never even touches its shore.
Return True if such a walk exists, and False otherwise.width=4, height=3, ponds=[[2, 2, 1]] → True
The pond touches only the top side of the park. You can pass below it, near the bottom side, and climb to the corner (4, 3) to the right of the pond.
width=4, height=4, ponds=[[2, 1, 1], [2, 3, 1]] → False
The lower pond touches the bottom side of the park, the upper one touches the top side, and they touch each other at (2, 2). Together they wall the park off, so there is no way around.
width=5, height=5, ponds=[[6, 6, 2]] → False
The corner (5, 5) lies inside the pond, so it cannot be reached.
width=4, height=3, ponds=[[2, 2, 1]]
True
Run checks the first 3 tests in your browser. Submit checks all 108 tests on the server, hidden ones included.