4. CSES Planets Queries I | Binary Lifting on Functional Graphs
Master Binary Lifting on functional graphs. In this video, we solve CSES Planets Queries I, tackling a scenario where nodes have exactly one outgoing edge, creating complex cycle structures (successor graphs). Instead of simulating 10^9 teleporter jumps and getting a Time Limit Exceeded (TLE) error, we apply the up[node][i] binary lifting table to calculate massive jumps in O(log K) time. We will walk through the exact C++ implementation and the critical bitwise shift logic required to clear this problem.1 π What you will learn: - The difference between strict trees and functional graphs - Why k = 10^9 requires exactly 30 bits for our state table - Building the O(N log K) preprocessing table for successor graphs - Complete C++ code walkthrough for CSES Planets Queries I π Problem Link:CSES Planets Queries I: https://cses.fi/problemset/task/1750 π πππ₯ππ¨π¦π ππ¨ ππ‘π ππ‘ππ§π§ππ₯!β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£ β£β£β£β£β£β£ 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 #CSES #BinaryLifting #GraphTheory
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.