SPOJ BITMAP
From Algorithmist
Revision as of 08:24, 15 September 2009 by 117.97.206.52 (Talk)
Contents |
[edit] 206 (BITMAP) - BITMAP
[edit] Summary
Within a rectangle, determine the distance from each pixel of said rectangle to the nearest specified pixels.
The input rectangle is provided as a grid of numbers, and a specified pixel is '1' insead of '0'. There is at least one marked pixel.
The distance is the sum of the row and column differences rather than a direct line.
[edit] Explanation
based on bfs
[edit] Gotchas
[edit] Notes
[edit] Implementations
[edit] Optimizations
[edit] Input
1 3 4 0001 0011 0110
[edit] Output
3 2 1 0 2 1 0 0 1 0 0 1