Back to Browse

10. Implicit Graphs & State Spaces | BFS (Codeforces Getting Zero)

54 views
May 17, 2026
22:17

Kicking off Phase 3: Implicit Graphs. Up until now, we have relied on explicitly allocated memory structures like adjacency lists and 2D grid matrices to define our networks. In this lecture, we strip away that memory overhead and traverse pure mathematical logic. We tackle Codeforces "Getting Zero" by treating integer values as nodes and arithmetic operations as directed edges. By combining this implicit state space with the reverse-graph logic we mastered in Phase 2, we run a single wave backward from our target state (0) to precompute the shortest path to all possible 32,768 states. This allows us to resolve any number of queries with O(1) lookups. We also break down the critical modulo wrap-around math required when reversing a "multiply by 2" operation. πŸ”— Problem Link: https://codeforces.com/contest/1661/problem/B πŸ‘‹ π–πžπ₯𝐜𝐨𝐦𝐞 𝐭𝐨 𝐭𝐑𝐞 𝐜𝐑𝐚𝐧𝐧𝐞π₯!⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ ⁣⁣⁣⁣⁣⁣ 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

Download

0 formats

No download links available.

10. Implicit Graphs & State Spaces | BFS (Codeforces Getting Zero) | NatokHD