Given a n * m matrix of 0s and 1s. For each square,find the sum of Manhattan distances from that square to the kth nearest 1s.
(Distance to closest 1 + distance to second closest 1 + ...)
n, m <= 2000
Thanks!
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Sum of kth smallest distances.
Given a n * m matrix of 0s and 1s. For each square,find the sum of Manhattan distances from that square to the kth nearest 1s.
(Distance to closest 1 + distance to second closest 1 + ...)
n, m <= 2000
Thanks!
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en3 | Loserinlife | 2023-10-29 06:43:38 | 6 | Tiny change: 're to the kth neare' -> 're to the first kth neare' | ||
en2 | Loserinlife | 2023-10-29 06:43:08 | 58 | |||
en1 | Loserinlife | 2023-10-29 06:42:30 | 249 | Initial revision (published) |
Name |
---|