MLE when using pointer in a multitest problem

Revision en1, by ExtraStageLover, 2023-12-24 20:50:20

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ExtraStageLover 2023-12-24 20:50:20 604 Initial revision (published)