How can i improve this implementation , current gives TLE , is my TC calculation right ?

Правка en2, от rickgrimes07, 2025-03-26 23:24:30

https://cses.fi/problemset/task/1139

https://cses.fi/paste/cdb7092742c2c314be200e/

DFS , TC: O(n)

m=2*n

Segment tree , build and query , O(mlogmlogm) , roughly

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский rickgrimes07 2025-03-26 23:24:30 86
en1 Английский rickgrimes07 2025-03-26 23:23:50 196 Initial revision (published)