Back to Browse

4. CSES Planets Queries I | Binary Lifting on Functional Graphs

126 views
May 26, 2026
15:00

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 formats

Video Formats

360pmp417.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

4. CSES Planets Queries I | Binary Lifting on Functional Graphs | NatokHD