Загрузка...

9. Boundary-Seeded Multi-Source BFS | Sparse Grids (Codeforces Nearest Excluded Points)

Advancing our Multi-Source BFS toolkit. In this lecture, we solve Codeforces "Nearest Excluded Points" and introduce the "Inward Wave" technique.

Instead of searching outward from every point (which yields a Time Limit Exceeded verdict), we reverse the paradigm. We identify the "coastline" of our coordinate set—the boundary points directly adjacent to empty space—and seed them into our queue. From there, we run our Multi-Source BFS inward, allowing deep interior points to inherit the optimal exit coordinates from their parents in O(N log N) time. We also transition away from standard 2D arrays, utilizing std::set and std::map to handle sparse grids with massive coordinate bounds.

🔗 Problem Link: https://codeforces.com/contest/1651/problem/D

👋 𝐖𝐞𝐥𝐜𝐨𝐦𝐞 𝐭𝐨 𝐭𝐡𝐞 𝐜𝐡𝐚𝐧𝐧𝐞𝐥!⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ ⁣⁣⁣⁣⁣⁣
I create content on Competitive Programming, Data Structures & Algorithms (DSA), and now Software Development with Go.
If you find this video helpful, don’t forget to:
👍 Like the video
💬 Comment your doubts/questions (I reply to everyone!)
🔔 Subscribe and turn on notifications to never miss upcoming tutorials
⁣⁣⁣⁣⁣⁣
📌 𝐂𝐨𝐧𝐧𝐞𝐜𝐭 𝐰𝐢𝐭𝐡 𝐦𝐞:⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ ⁣⁣⁣⁣⁣⁣
🐦 X: https://x.com/Yash_Poonia_
💼 LinkedIn: https://www.linkedin.com/in/yashpoonia/
💻 GitHub: https://github.com/yash7xm/
🌐 Discord: https://discord.gg/dAp2PbKFpV

#BFS #CompetitiveProgramming #GraphTheory #Codeforces #Algorithms #Cplusplus #SoftwareEngineering

Видео 9. Boundary-Seeded Multi-Source BFS | Sparse Grids (Codeforces Nearest Excluded Points) канала Yash Poonia
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять