Tap here to switch tabs
Problem
Submissions

Problem: Determine if a Cell Is Reachable at a Given Time

Determine if a Cell Is Reachable at a Given Time asks whether a target on an infinite grid can be reached from the start in the given time, with each move reaching one of eight adjacent cells.

Statement

You are given four integers sx, sy, fx, and fy, representing the starting coordinate (sx, sy) and the target coordinate (fx, fy) on an infinite two-dimensional grid. You are also given a non-negative integer t.

Each second, you must move to any of the 88 adjacent cells (horizontally, vertically, or diagonally).

Return true if you can reach the target coordinate (fx, fy) in exactly t seconds, and false otherwise.

Constraints:

  • 1≤1 \leq sx, sy, fx, fy ≤109\leq 10^9

  • 0≤0 \leq t ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Determine if a Cell Is Reachable at a Given Time

Determine if a Cell Is Reachable at a Given Time asks whether a target on an infinite grid can be reached from the start in the given time, with each move reaching one of eight adjacent cells.

Statement

You are given four integers sx, sy, fx, and fy, representing the starting coordinate (sx, sy) and the target coordinate (fx, fy) on an infinite two-dimensional grid. You are also given a non-negative integer t.

Each second, you must move to any of the 88 adjacent cells (horizontally, vertically, or diagonally).

Return true if you can reach the target coordinate (fx, fy) in exactly t seconds, and false otherwise.

Constraints:

  • 1≤1 \leq sx, sy, fx, fy ≤109\leq 10^9

  • 0≤0 \leq t ≤109\leq 10^9