1 / 3
May 2020

I did this question using naive approach in 0.32 seconds.
But to do better i did it with binary lifting which resulted in 0.35 seconds.

I tried so many times but could not do better.
Can someone plz help me in finding out whether something is wrong with my binary lifting approach.

Question: https://www.spoj.com/problems/LCA/5
Solution using binary lifting- https://ideone.com/vjf7wj5

  • created

    May '20
  • last reply

    May '20
  • 2

    replies

  • 460

    views

  • 2

    users

  • 3

    links

Nothing much difference,
I added
ios_base::sync_with_stdio(false);
cin.tie(NULL);
https://ideone.com/PXE6An
Time came - 0.29.
But many have solved using binary lifting in 0.02 seconds.
How can i achieve it?