Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Find Mex in a tree path
Разница между en1 и en2, 22 символ(ов) изменены
i have a problem as follow Given a tree with n nodes with unique value  for each node and q queries as given two nodes a and b ,find Mex between a andin the path from a to b for each query↵

(1<n,q<200000)↵

my solution is using Mo algorithm as mentioned [Here](https://codeforces.net/blog/entry/43230). i can find the Mex either using segment tree or set with log(n) for each query,but i think it is a bit hard for my solution to be valid under this constraints .↵

is there another solution with a better time complexity ?↵

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Khalell 2024-02-28 16:17:37 22 Tiny change: ',find Mex between a and b for eac' -> ',find Mex in the path from a to b for eac'
en1 Английский Khalell 2024-02-28 16:16:24 533 Initial revision (published)