Tap here to switch tabs
Problem
Submissions

Problem: Escape a Large Maze

Try to solve the Escape a Large Maze problem.

Statement

There is a 106×10610^6 \times 10^6 grid where coordinates (x,y)(x, y) satisfy 0≤x,y<1060 \leq x, y < 10^6. You are given an array of blocked cells blocked, where each blocked[i] =[xi,yi]= [x_i, y_i] represents a cell that cannot be visited.

You are also given a starting cell source =[sx,sy]= [s_x, s_y] and a destination cell target =[tx,ty]= [t_x, t_y].

From any cell, you can move to an adjacent cell in any of the 44 cardinal directions (up, down, left, or right), provided that the next cell is within the grid boundaries and is not contained in blocked.

Return true if it is possible to reach target from source, or false otherwise.

Constraints:

  • 0≤0 \leq blocked.length ≤200\leq 200

  • blocked[i].length =2= 2

  • 0≤xi,yi<1060 \leq x_i, y_i < 10^6

  • source.length == target.length =2= 2

  • 0≤sx,sy,tx,ty<1060 \leq s_x, s_y, t_x, t_y < 10^6

  • source ≠\neq target

  • It is guaranteed that source and target are not blocked.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Escape a Large Maze

Try to solve the Escape a Large Maze problem.

Statement

There is a 106×10610^6 \times 10^6 grid where coordinates (x,y)(x, y) satisfy 0≤x,y<1060 \leq x, y < 10^6. You are given an array of blocked cells blocked, where each blocked[i] =[xi,yi]= [x_i, y_i] represents a cell that cannot be visited.

You are also given a starting cell source =[sx,sy]= [s_x, s_y] and a destination cell target =[tx,ty]= [t_x, t_y].

From any cell, you can move to an adjacent cell in any of the 44 cardinal directions (up, down, left, or right), provided that the next cell is within the grid boundaries and is not contained in blocked.

Return true if it is possible to reach target from source, or false otherwise.

Constraints:

  • 0≤0 \leq blocked.length ≤200\leq 200

  • blocked[i].length =2= 2

  • 0≤xi,yi<1060 \leq x_i, y_i < 10^6

  • source.length == target.length =2= 2

  • 0≤sx,sy,tx,ty<1060 \leq s_x, s_y, t_x, t_y < 10^6

  • source ≠\neq target

  • It is guaranteed that source and target are not blocked.