Tap here to switch tabs
Problem
Submissions

Problem: Minimum Sensors to Cover Grid

med
30 min
Try to solve the Minimum Sensors to Cover Grid problem.

Statement

You are given two integers n and m representing the dimensions of an nimesmn imes m grid, and an integer k representing the coverage range of a sensor.

A sensor placed at a cell (r,c)(r, c) covers any cell (r′,c′)(r', c') in the grid that satisfies ∣r−r′∣≤k|r - r'| \leq k and ∣c−c′∣≤k|c - c'| \leq k.

Return the minimum number of sensors required to cover every cell in the grid.

Constraints:

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq m ≤103\leq 10^3

  • 0≤0 \leq k ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Sensors to Cover Grid

med
30 min
Try to solve the Minimum Sensors to Cover Grid problem.

Statement

You are given two integers n and m representing the dimensions of an nimesmn imes m grid, and an integer k representing the coverage range of a sensor.

A sensor placed at a cell (r,c)(r, c) covers any cell (r′,c′)(r', c') in the grid that satisfies ∣r−r′∣≤k|r - r'| \leq k and ∣c−c′∣≤k|c - c'| \leq k.

Return the minimum number of sensors required to cover every cell in the grid.

Constraints:

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq m ≤103\leq 10^3

  • 0≤0 \leq k ≤103\leq 10^3