Can somebody help me in this Distance Queries CSES Problem [Solved]
Разница между en1 и en2, 9 символ(ов) изменены
Hello Codeforces Community, I was recently trying to solve [this problem on CSES](https://cses.fi/problemset/task/1135/)↵
↵
Following is my approach and code.↵
Approach — Find LCA using Binary Lifting and then compute distance of a to b by doing the following↵
depth[a] + depth[b] — 2 * depth[lca(a, b)].↵
↵
[Link to my code](https://cses.fi/paste/9130159e3f49193bf48e3b/)↵
↵
But I am continuously getting TLE on test 6 and 7(this is not a meme, I am really having difficulty). Can someone help me with what exactly the issue is out here? Is it some large constant factor or smth else. Any help is appreciated.↵

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский luminarae 2026-01-23 16:41:56 9
en1 Английский luminarae 2026-01-23 15:05:37 682 Initial revision (published)