ExtraStageLover's blog

By ExtraStageLover, history, 12 months ago, In English

Hi, I am trying to solve this problem. Given a tree with n nodes and m queries, each node have a value assign to it, for each query of the form (x, y, val), return the maximum value of (a(i) XOR val), a(i) is the value of the ith node and (i) must on the path from x to y.

My approach is using persistent trie, I solved it by implement with array for trie but when I tried using pointer its MLE. Does anybody what is wrong with my code, I think pointer is better since you may miscalculate the memory when using array.

My code: https://ideone.com/jWOuw7

  • Vote: I like it
  • 0
  • Vote: I do not like it