We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Subtrees And Paths
Subtrees And Paths
Sort by
recency
|
11 Discussions
|
Please Login in order to post a comment
The problem has a problem: How can the two lines "5 1" and "1 2" both mean 1 is the root? Either we infer that 1 is always the root, or that smaller is always the root, but left --> right clearly doesn't work. The paths clearly have a direction, because if the paths were bidirectional, then any add query would add to all nodes.
C++ solution
2 99 32 99 76 99 33 76
How to connect them. What is the head of what? What are the sub-nodes of each node?
Can a node have two heads?
Submission failed with test case 3, but copy the data into customerized test passed. The 4th line of output should be -1487 instead of 1213 ? Can anyone help me?
Hey guys i solved the problem using heavy light decomposition incorporating segment tree lazy propagation .
I managed to secure 112.5/120 point . (with 47/50 test cases passed)
just three test cases aborted due to i assume because of memory limits
i again wrote quite well long commented/documented code wchin you can find on submissions abhishek's submsission commented/documented code wchin you can find on submissions [(https://www.hackerrank.com/challenges/subtrees-and-paths/submissions/code/202527244)