How to solve this problem using bfs?

Revision en1, by hitman264, 2021-05-14 07:13:12

Prelude-

Before people start bashing me, I just wanted to say that the problem is highly rated(2400), so would be too much for me to solve.

However, after spending a day on it :p , I figured out that I can binary search on the answer by taking a prospective number as the maximum and check if we can form a path using <=k nodes as the path, while the Mac distance from this path would be <= prospective answer.

Tags #bfs, # dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English hitman264 2021-05-14 18:47:17 94 add the part of confusion
en2 English hitman264 2021-05-14 18:44:27 1065 Tiny change: 'o use - \n* **Binary ' -> 'o use - \n- **Binary ' (published)
en1 English hitman264 2021-05-14 07:13:12 452 Initial revision (saved to drafts)