CSES Planet Query — 1

Правка en1, от sujal22514, 2024-07-16 17:07:17

Problem Link : https://cses.fi/problemset/task/1750 Submission Link : https://cses.fi/paste/f2a12df5ba1948a496b5bf/

I am not sure why my code this TLE on one test case (where N and Q are 10^5). I tried doing it using binary Lifting , The matrix A is used to store descendants at 2^j position where j<= 35

I believe the solution should not take more then O(q*35+35*n) steps.

Can someone Please help me out?

Теги binary lifting, cses

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский sujal22514 2024-07-16 17:08:02 3
en1 Английский sujal22514 2024-07-16 17:07:17 438 Initial revision (published)