Tap here to switch tabs
Problem
Submissions

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

med
30 min
Try to solve the Determine if a Cell Is Reachable at a Given Time problem.

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

med
30 min
Try to solve the Determine if a Cell Is Reachable at a Given Time problem.

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