• + 0 comments

    Rust solution - work in progress here. The solution so far produces correct results, but has TLE's and is in need of some optimization. I'm looking at compressing the sparse branches while preserving the ability to calculate node values on the fly.

    Things I wish the problem description had told me:

    • The end points of the edges in the input data can be in either order.
    • May need to traverse tree starting at root to fix parent child relationships.
    • The queries can involve finding common ancestor.
    • Update values with +=: .value += v + d * k;